The dropdown menu is failing to display its list of options

How can I make a dropdown menu that appears when I click the down arrow glyphicon? The menu should contain items like Messages and Log Out. Currently, when I click on it, nothing shows up. What could be missing here?

//Html File: 

<html>
<!-- Head -->
<head>
     <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/bootstrap-theme.min.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link href="css/bootstrap-social.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">


</head>

<!-- Body --> 
<body>
<div class="navbar">
  <a  href="#"><i class="fa fa-home"></i> Marble </a> 
  <a class="left"> <i onclick="myFunction(this)" class=" fa fa-bell" ></i> Notifications </a> 
  <a class="left user"> <i class=" fa fa-user-circle"> </i> User   </a>

  <div class="dropdown">
  <a class="editClass dropdown-toggle" data-toggle="dropdown" >  <span class=" glyphicon glyphicon-menu-down"></span> </a>
  <ul class="dropdown-menu" > //when i remove class="dropdown-menu", the items appears but the drop down is gone, and when i add them back, the items are not shown when i click the drop down icon.
    <li> <a> <i class="fa fa-envelope-o"></i> Messages </a> </li>
    <li role="separator" class="divider"></li>
    <li> <a> <i class="fa fa-hourglass-3"></i> Timeline </a> </li>
    <li role="separator" class="divider"></li>
    <li> <a> <i class="fa fa-cog"></i> Settings </a> </li>
    <li role="separator" class="divider"></li>
    <li> <a> <span class="glyphicon glyphicon-log-out"></span> Log Out </a> </li>
    <li role="separator" class="divider"></li>
  </ul>

</div>
</div> 

<div>
    <img src="Diagram.png" alt="diagram" width="400" height="300"> 
</div>
<div>
    <p id="sentence"> "You don't have any projects" </p>
    <button onclick="createProject()" class="button1 btn btn-lg"> <b> Add Project </b> </button>
</div>
<div>
    <form class="form-popup" id="projects">
        <h2 align="center"> <span class="glyphicon glyphicon-th"></span> New Project </h2>
        <input type="text" placeholder="Project Name"  required> <br>
        <textarea placeholder="Project Description" required=""></textarea> <br>
        <p> Start Date: </p> 
        <p> End Date: </p>
        <input type="Date" name="start Date" required="">
        <input type="Date" name="End Date" required="">
        <h2 align="center"> <span class="glyphicon glyphicon-book"> </span> References </h2>
        <div id="refTextBoxes">
        <input type="text" placeholder="Add Reference" required> <br>
        </div>
        <button onclick="addRef()"> Add another </button> <br>
        <button type="submit" onclick="hideAndAdd()" > Done </button>
        <!-- class="btn" bt3ml el button shakl kda 7elw --> 

    </form>
</div>


  <script>

  function myFunction(x)
   {
  x.classList.toggle("fa-bell-slash");
    }
  function createProject()
   {
  document.getElementById("projects").style.display = "block";
   }
  function addRef()
  {
    var totalTextBoxes = document.getElementsByClassName("input_text");
    totalTextBoxes = totalTextBoxes.length + 1;  
    document.getElementById("refTextBoxes").innerHTML=document.getElementById("refTextBoxes").innerHTML+
   "<input type='text' class='input_text' id='input_text"+totalTextBoxes+"' placeholder='Add Reference' + required> <br>";
  }
  function hideAndAdd()
  {
     var x = document.getElementById("sentence");
     x.style.display = "none";
  }

  </script>

</body>


<!-- Closing of html tag -->
</html>

//Css File:

body
 {
  font-family: Arial, Helvetica, sans-serif;
  /* background-color: #ABB1BA; */
 }
.form-popup
{
  display: none;
}

/* Style the navigation bar */
.navbar
{
  width: 100%;
  background-color: #877ebf;
  overflow: auto;
}

/* Navbar links */
.navbar a
{
  float: left ;
  text-decoration: none;
  color: #CCCCCC;  
  font-size: 17px;
  padding: 12px;
}


/* Navbar links on mouse-over */
.navbar a:hover, i:hover, span:hover
{
  background-color: #555;
  cursor: pointer;
}

img
{
  display: block;
    margin-left: auto;
    margin-right: auto;
}
p
{
  text-align: center;
  font-family: "Arial Black", Gadget, sans-serif;
    font-size: 20px;
}
button 
{

  text-align: center;  
  font-size: 16px;
  margin: 25px 475px;
  cursor: pointer;

}
.button1 
{
  background-color: #CCCCCC; 
  color: #333333; 
  border: 4px solid #877ebf;
}
/*
.navbar i.editClass, span.editClass
{
  float: right;
}
*/ 
.left
{
  position: absolute;
    right:135;
}
.user
{
  /*margin: 25px 25px; */
  /*float: right;
  padding: 100px; */
  position: absolute;
    right:40;
}
.editClass
{
  position: absolute;
    right:5;
}
/* Add responsiveness - will automatically display the navbar vertically instead of horizontally on screens less than 500 pixels */
@media screen and (max-width: 500px) {
  .navbar a {
    float: none;
    display: block;
  }
}

I'm trying to implement a dropdown menu using Bootstrap, HTML, and CSS. However, I am facing issues with the display. Could the problem possibly lie within the CSS file?

Answer №1

The overflow property on your navbar is currently hiding content effectively. Consider removing it.

.navbar {
    /* overflow: auto; */
}

Check out the demo here

Take some time to explore your browser's document inspector as it can greatly simplify identifying and fixing issues like this one.

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

Error encountered when compiling SCSS with the '@use' statement

Currently, I am utilizing Gulp for the purpose of compiling scss into css. However, whenever I include a @use statement in my code, it does not compile the css correctly into the css file; instead, it simply duplicates the @use statement. What could be cau ...

I am looking to load an alert message simultaneously with loading an HTML link

My request is for a pop-up sweet alert to appear when the "accept your promotion" button is clicked, along with calling a relevant link at the same time. This link will update a data column in a database based on Boolean values. <script src="https://cd ...

I'm striving to achieve a one-line layout using Bootstrap 4, but unfortunately it's not functioning as intended

Here is my HTML code using Bootstrap4: <div> <span class="d-inline-block"> <i class="fa fa-file-alt fa-3x text-primary"></i> </span> <span class="d-inline-block">Cadastre number: & ...

If querying does not yield any results, proceed to insert the data

Currently, I am facing an issue with a transaction that involves inserting data into a table. Whenever the data already exists in the table, it triggers a constraint failed error and then executes a select query to retrieve the ID. t2.executeSql('INS ...

Can JavaScript/JQuery be used to dynamically alter the color of a dropdown menu or change the color of list items when a radio option is selected?

Is it possible to enhance the functionality of my code that currently selects a radio option and automatically changes the dropdown box? Can I also make the selected dropdown item change color, such as blue for 'Work', green for 'Grocery&apo ...

Unable to process form submission using Ajax in ASP.NET MVC

I'm having trouble with submitting a form using ajax and opening a modal dialog after the ajax function is successful. Whenever I click the submit button, the process doesn't complete. Where could the issue be, in the ajax method or somewhere el ...

Explore the Shopify assistance on the secondary blog section within a separate page

Hey there, I'm looking for someone who is familiar with Shopify and can assist me. I am currently trying to set up a secondary Blog section on a separate page from my default 'Blog Page', but I'm encountering issues in displaying the a ...

Element flickering occurs when hovering over an element with an animation present

I'm currently working on a hover navigation, which was functioning properly until I introduced animations. Now, whenever there is an animation involving movement, it seems to flicker when hovered over. Here is the code causing the issue. When I remov ...

jQuery Mobile - Implementing Persistent Toolbars along with a custom back button functionality

UPDATE Here is a fiddle of the problem: https://jsfiddle.net/9k449qs2/ - attempt to select the header using your picker, but every time you click it will select the whole page instead. I am currently working on a project that includes a persistent header ...

What is the best way to integrate data-bs-toggle into my code?

I am currently exploring the use of data-bs-toggle with Bootstrap, but as a newcomer to the framework, I might be missing something essential in my setup. When attempting to implement data-bs-toggle, I notice that my autocomplete suggestions only include d ...

When floating a heading 4 (h4) and two divs to the left, and a single div to the right,

When floating a h4 and 2 divs to the left, and another div to the right, how can I place a block inside the remaining space that perfectly fills it? The background color of this space should not spread outside. [h4][div][div][remaining space][div] Thank ...

Looking to incorporate nested rules in `JSS` using `CSS`?

Can someone guide me on how to use CSS class-nesting in Material-UI or JSS in general? I have been attempting the following: card: { cardHeader:{ marginTop:"30px" } } ...

The jQuery panel slider magically appears when you click the button, but refuses to disappear

One issue I am facing on my webpage involves a button that triggers a right panel to open using the jquery and modernizr frameworks. The button is positioned at the far right of the screen. When clicked, it slides to the left along with the panel it reveal ...

Utilize jQuery method in HTML to perform parsing operation

Is it possible to invoke my jQuery function from within my HTML code? Here is the code snippet: HTML section: <td style="text-align:left;" align="left" > <div id="bulletin-timestamp" > doTimeStamp(${bulletinTimeStamp[status.index ...

Guide to customizing CSS styles within a div element using TypeScript code in a Leaflet legend

I'm struggling to add a legend to my map using Angular 5 and typescript. I need help with setting CSS styles for the values (grades) that are displayed on the legend. Can someone guide me on where to put the styles? TS: createLegend() { let lege ...

The appended button remains unresponsive when clicked

After conducting extensive research, I have come across numerous questions on overflow regarding a specific issue, but none of the solutions seem to work. The problem revolves around a button that appears on the page when another element is clicked. The u ...

When I click on my Material UI avatar image, it seems to override the button I had in

Every time I try to create a basic category filter with images, I encounter a frustrating bug. After examining the console log, it seems that when I click on the button, my image is being clicked and behaving like an image. However, when I click around the ...

What is the best way to modify the class of a specific element without having to create a duplicate?

I am currently working on a dynamic calendar feature. When users add an event on a specific date, I want the date cell in the calendar to change its background color by switching to a different CSS class. Here is the code snippet of what I have attempted ...

Creating dynamic web content using PHP and JavaScript

I stumbled upon a tutorial on the PHP.net website within the "PHP and HTML" manual which includes an example titled Generating JavaScript with PHP. Currently, I am experimenting with a basic demo of this concept on my own to grasp the process before attem ...

Ensuring the size of the description box remains constant during window resizing in a fancy and

When resizing the window, I noticed that the description box next to the pop-up image in fancybox does not adjust its size accordingly. The image reduces in size but the description box remains the same. Is there a way to make the description box resize al ...