Dropdown Menu covered by div

Crimson-Med

Hello I want to add a dropdown menu to my top navigation bar. But for some reason it gets hidden by my image slider. I would like the dropdown content to be on top of everything as it should be.

/* Style The Dropdown Button */
.dropbtn {
  cursor: pointer;
}
/* The container <div> - needed to position the dropdown content */
.dropdown {
  position: relative;
  display: inline-block;
  z-index: 999;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #565656;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
/* Links inside the dropdown */
.dropdown-content a {
  color: white;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {
  background-color: #f1f1f1
}
/* Show the dropdown menu on hover */
.dropdown:hover .dropdown-content {
  display: block;
}
<div id="header">
  <ul>
    <li>
      <a class="a-no-hover" href="index.html">
        <img src="images/miniLogo.png" />
      </a>
    </li>
    <li><a class="active" href="index.html">HOME</a>
    </li>
    <div class="dropdown">
      <li class="dropbtn"><a href="product.html">PRODUCTS</a>
      </li>
      <div class="dropdown-content">
        <a href="#">Link 1</a>
        <a href="#">Link 2</a>
        <a href="#">Link 3</a>
      </div>
    </div>
    <li><a href="order.php">ORDER</a>
    </li>
    <li><a href="about.html">ABOUT US</a>
    </li>
    <li><a href="contact.html">CONTACT US</a>
    </li>
  </ul>
</div>
<div id="section1">
  <img id="img" src="images/bg.jpg" />
</div>

Praveen Kumar Purushothaman

You are giving z-index to the header menu, that's fine. But the content is what is the problem. So, try giving z-index to the .dropdown-content:

/* Dropdown Content (Hidden by Default) */
.dropdown-content {
  display: none;
  position: absolute;
  background-color: #565656;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 1000; /* One more than the header. */
}

Update

#header ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  /* overflow: hidden; Remove this. */
  text-align: center;
  vertical-align: middle;
}

Preview

enter image description here

Output: http://jsbin.com/lorebubizi/1

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Dropdown Menu covered by div

From Dev

Dropdown Menu hides behind div

From Dev

DIV is covered by previous DIV

From Dev

CSS menu: width of dropdown items limited by div

From Dev

Show div contents on click on dropdown menu

From Dev

Populating dropdown menu in separate div from php

From Dev

Dropdown menu is dropping behind 'content' div

From Dev

Div dropdown menu show/hide onclick jquery

From Dev

why my dropdown menu is not working in the div?

From Dev

Nav Bar Menu - Covered with Contents

From Dev

Fixed DIV not covered by following DIV

From Dev

Fixed DIV not covered by following DIV

From Dev

Dropdown menu in ... a dropdown menu with Bootstrap

From Dev

Bootstrap expanded collapsible menu covered in xs grid

From Dev

How to make HTML component is not covered by footer menu?

From Dev

Pure CSS dropdown menu click to hide or show div?

From Dev

bootstrap ScrollSpy not jump to div when click on dropdown menu item

From Dev

Twitter Bootstrap Broader Dropdown Menu with 2 or more Div

From Dev

How to hide dropdown div after clicking aside of its parent menu?

From Dev

Pure CSS dropdown menu click to hide or show div?

From Dev

Expand div inside table cell like dropdown menu

From Dev

CSS dropdown menu adds scroll bars to header div on hover

From Dev

Bootstrap & jQuery - Toggle Div based on Bootstrap Dropdown Menu open or close

From Dev

bootstrap ScrollSpy not jump to div when click on dropdown menu item

From Dev

link didn't work outside of div in notification dropdown menu?

From Dev

Drop down div infront of or blocking its dropdown menu

From Dev

Position Div On Top of Background Image ( covered / repsonsive )

From Dev

Dropdown button in a dropdown menu in Bootstrap

From Dev

Target header nav dropdown being covered up by divs using jQuery

Related Related

  1. 1

    Dropdown Menu covered by div

  2. 2

    Dropdown Menu hides behind div

  3. 3

    DIV is covered by previous DIV

  4. 4

    CSS menu: width of dropdown items limited by div

  5. 5

    Show div contents on click on dropdown menu

  6. 6

    Populating dropdown menu in separate div from php

  7. 7

    Dropdown menu is dropping behind 'content' div

  8. 8

    Div dropdown menu show/hide onclick jquery

  9. 9

    why my dropdown menu is not working in the div?

  10. 10

    Nav Bar Menu - Covered with Contents

  11. 11

    Fixed DIV not covered by following DIV

  12. 12

    Fixed DIV not covered by following DIV

  13. 13

    Dropdown menu in ... a dropdown menu with Bootstrap

  14. 14

    Bootstrap expanded collapsible menu covered in xs grid

  15. 15

    How to make HTML component is not covered by footer menu?

  16. 16

    Pure CSS dropdown menu click to hide or show div?

  17. 17

    bootstrap ScrollSpy not jump to div when click on dropdown menu item

  18. 18

    Twitter Bootstrap Broader Dropdown Menu with 2 or more Div

  19. 19

    How to hide dropdown div after clicking aside of its parent menu?

  20. 20

    Pure CSS dropdown menu click to hide or show div?

  21. 21

    Expand div inside table cell like dropdown menu

  22. 22

    CSS dropdown menu adds scroll bars to header div on hover

  23. 23

    Bootstrap & jQuery - Toggle Div based on Bootstrap Dropdown Menu open or close

  24. 24

    bootstrap ScrollSpy not jump to div when click on dropdown menu item

  25. 25

    link didn't work outside of div in notification dropdown menu?

  26. 26

    Drop down div infront of or blocking its dropdown menu

  27. 27

    Position Div On Top of Background Image ( covered / repsonsive )

  28. 28

    Dropdown button in a dropdown menu in Bootstrap

  29. 29

    Target header nav dropdown being covered up by divs using jQuery

HotTag

Archive