Why isn't the dropdown menu displaying beneath the background in bootstrap / HTML / CSS?

Having trouble creating a navbar with a dropdown menu on the right? I encountered an issue where the menu doesn't show up when clicked. However, after removing all CSS styles, the button starts working.

.info {
  margin-top: 15%;
  display: table;
  height: 100%;
  width: 100%;
}

#navbar {
  background: red;
  position: fixed;
  top: 0px;
  width: 100%;
}

.content {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
  color: #fff;
  font-size: 12px;
}

h1 {
  color: rgb(255, 255, 255);
  border: 3px solid #fff;
  text-align: center;
  background: rgba(0, 0, 0, 0.1);
  font-size: 40px;
  font-weight: normal;
  padding: 30px;
  margin: 15px;
  display: inline-block;
  background: rgba(0, 0, 0, 0.4);
}


/* Menu */

ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: rgb(87, 41, 41);
}

li {
  float: left;
}

li a {
  display: block;
  color: white;
  text-align: center;
  padding: 20px 25px;
  text-decoration: none;
}

li a:hover {
  background-color: #111;
}

.active {
  background-color: #04AA6D;
}

.conc {
  float: right;
}

html,
body {
  height: 100%;
}

body {
  background: url(../img/main_learn.jpg) no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  overflow: hidden;
}

input[type=range] {
  margin: 10px;
  width: 50px;
}
<div id="navbar">
  <ul>
    <li><a href="index.php?idp=glowna">Strona główna</a></li>
    <li><a href="index.php?idp=aktualnosci">Aktualności</a></li>
    <li><a href="index.php?idp=instrumenty">Instrumenty</a></li>
    <li><a href="index.php?idp=musicale">Musicale</a></li>
    <li><a href="index.php?idp=nauka">Nauka</a></li>
    <li><a href="index.php?idp=chart">Charty</a></li>
    <li><a href="index.php?idp=filmy">Filmy</a></li>
    <li><a href="index.php?idp=chaos">Chaos</a></li>
    <li class="conc">
      <div class="dropdown show">
        <a class="dropdown-toggle" href="#" role="button" id="dropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
    Dropdown link
  </a>

        <div class="dropdown-menu" aria-labelledby="dropdownMenuLink">
          <a class="dropdown-item" href="#">Action</a>
          <a class="dropdown-item" href="#">Another action</a>
          <a class="dropdown-item" href="#">Something else here</a>
        </div>
      </div>
      <!-- <a href="index.php?idp=kontakt"><b>Kontakt</b></a> -->
    </li>
  </ul>
</div>

Experiencing issues even after trying to comment out individual styles like overflow: hidden, etc.? The dropdown button used is from Bootstrap documentation and Popper.js has been included.

Answer №1

Instructions for setting up a navbar with dropdown menu on the right:

The necessary CSS and HTML

body {
          min-height: 100vh;
        }
        .navbar {
          position: fixed;
          width: 100%;
          top: 0;
          left: 0;
        }
        .container {
          float:left;
          clear: left;
        }
<div id="wrapper">  
      <nav class="navbar navbar-expand-lg navbar-light bg-light">
        <div class="container-fluid">
          <a class="navbar-brand" href="#" cursorshover="true">Title</a>
          <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor03" aria-controls="navbarColor03" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarColor03">
            <ul class="navbar-nav me-auto">
              <li class="nav-item">
                <a class="nav-link active" href="#" cursorshover="true">Home
                  <span class="visually-hidden">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="{% url 'play' %}" cursorshover="true">Play</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="{% url 'chat' %}" cursorshover="true">Chat</a>
              <</li>
              <li class="nav-item">
                <a class="nav-link" href="{% url 'about' %}" cursorshover="true">About</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false" cursorshover="true">Account</a>
              <div class="dropdown-menu" data-bs-popper="static">
                <a class="dropdown-item" href="{% url 'profile' %}" cursorshover="true">My Profile</a>
                <a class="dropdown-item" href="{% url 'settings' %}" cursorshover="true">Settings</a>
                <a class="dropdown-item" href="{% url 'scores' %}" cursorshover="true">Scores</a>
                <div class="dropdown-divider"></div>
                <a class="dropdown-item" href="{% url 'logout_user' %}" cursorshover="true" >Log Out</a>
              </div>
            </ul>
            <form class="d-flex">
              <input class="form-control me-sm-2" type="text" placeholder="Search">
              <button class="btn btn-secondary my-2 my-sm-0" type="submit" cursorshover="true">Search</button>
            </form>
          </div>
        </div>
      </nav>

Answer №2

I successfully resolved the issue by incorporating some style modifications

.dropdown {
position: top;

}

as well as eliminating

/* overflow: hidden; */

from the ul styling

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The behavior of CSS position: sticky varies depending on whether the user is scrolling up or scrolling down

I am experiencing an issue in my Vue CLI app where a component with the position: sticky CSS property is being partially hidden under the top of the browser when scrolling down, but works correctly when scrolling up. This behavior is also observed on my Ga ...

Create an HTML table with a static header, adjustable columns, and the ability to resize to a width smaller than the content

Looking to create a unique web application with a table that has a fixed, styled header, resizable columns, and the ability to resize the columns without truncating content. Additionally, I want the body of the table to scroll if it cannot all fit on the p ...

Access the document on the desktop and open it in a new popup window

As a novice in html coding, I'm wondering if it's possible to write window size and other properties directly into the page. Let me explain. I'm currently working on a calculator and I want to run the HTML file on my desktop. Everything wor ...

Center a form using Bootstrap

Struggling to center my form using bootstrap as a beginner. I've tried different methods without success. Hoping for some guidance on how to center it while keeping the same size. Any assistance would be appreciated! This is the HTML code: <div ...

I am trying to display my progress bar in a col-sm-6 format on screens larger than 546px, however, despite my attempts, I am not seeing any changes on the screen

Is there an alternative method if bootstrap is unable to handle this? I have used col-xs-6, but all I want is to display my progress bar in the image shown on small screens. Here is how I want to display my image on small screens. <div class="cont ...

Utilizing External Libraries Added Through <script> Tags in React

My goal is to develop a Facebook Instant HTML5 application in React. Following their Quick Start guide, Facebook requires the installation of their SDK using a script tag: <script src="https://connect.facebook.net/en_US/fbinstant.6.3.js"></scrip ...

Guide on How to Include data (PDF Base 64) in angular 6 component

Within my Angular 6 application, I am presenting data (a report) in a new window using the following code snippet. *** The 'result' variable contains Base64 data *** if (result != null) { const pdfWindow = window.open(""); ...

How can one determine the most accurate box-shadow values?

I am trying to extract the precise box-shadow parameters from a CSS style rule generated by the server. My main focus is determining whether the element actually displays a visible shadow or not. There are instances where the shadow rule is set as somethi ...

The correct way to reference images in the resources folder using a URL in CSS

After I generated a Maven dynamic web project using an archetype, I decided to organize the javascript, css, and image folders under the webapp folder. The structure now looks like this: myproject | main | | | java | | | resources | | ...

Adjusting Image Size with HTML and CSS

UPDATE* I am having an issue with the resizing of images on my website. The problem specifically pertains to the music tab where the image is not fitting within the div size properly. I have provided a screenshot for reference https://i.sstatic.net/Zbwag ...

What is the best way to use requests in python to enter text in a textarea, then scrape the html with bs4, all while the input remains hidden?

I'm working on a script that interacts with by sending a string and receiving one or all of the "fancy text" variations provided by the site. I am struggling to identify the input area within the HTML structure, especially since I aim to use requests ...

Having difficulty toggling a <div> element with jQuery

I am attempting to implement a button that toggles the visibility of a div containing replies to comments. My goal is to have the ability to hide and display the replies by clicking the button. The "show all replies" button should only appear if there are ...

How can I display a specific element from a child Component when the main Component is clicked on in React?

I am currently working on my first React project and facing a challenge. I have a dropdown list on my main homepage that displays specific details when clicked. However, I am struggling to show the right corresponding detail (for example, black&white paren ...

The display/block feature will only function if the div element is contained within a table

I am facing an issue with hiding/showing two div elements alternatively. The code works perfectly when the divs are placed within a table, but fails when they are not in a table due to compatibility issues with Internet Explorer. I prefer not to use a tabl ...

A see-through section with a border that fades in transparency

Can anyone help me with creating a box with a unique design using CSS only? I want the box to have a rounded border that starts at 80% opacity at the top and gradually fades to 20% opacity at the bottom. Additionally, the border should start at 80% opaque ...

CSS to resolve HTML alignment problems

I am new to HTML and CSS, trying to practice formulating a few things but my efforts are proving futile. Below is the code and images for your reference. I would appreciate your opinion. .container { display: block; width: 200px; height: 120px; } ...

When Python / Django's render_to_string function is used, the output is rendered as text containing HTML entities

A task I am working on involves migrating a Python/Django application from: Django==1.5.1 Python version 2.6.6 To: Django==3.2 Python version 3.6.8 One issue I am encountering is with a section of code that generates an HTML template as a string and add ...

Looking to distinguish selected options in a multiple select in AngularJS by making them bold?

When working with Angular, I have a multiple select drop down with options such as Select fruits, Apple, Orange, Banana. How can I make the selected options, like Banana and Apple, appear in bold and change background colors? ...

The jQuery .accordion() feature is not functioning properly due to the failure to load jQuery into the HTML document

I have exhaustively researched online and visited numerous resources, including Stack Overflow. Despite making countless adjustments to my code, it still refuses to function properly. The frustration is mounting as I struggle with jQuery - a technology tha ...

How to capture text outside of a HTML tag using Selenium with Python?

I need help extracting the specific text inside a div element that is not enclosed by a label. <div style="color:red;"> <label> Total Amount Due:</label> $0.00 </div> Only interested in retrieving the $0.00 amount from th ...