Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap dropdowns menus appearing behind other elements - IE7

I'm using Bootstrap 2.3.1 http://twitter.github.io/bootstrap/index.html

So I'm using their 'dropdown-menu' class to create some simple quick use dropdown menus, but for some reason on IE7 they are appearing behind text and other elements on my site.

Test Link: http://leongaban.com/_projects/defakto/CDS/

I added z-index to my CSS, but still doesn't seem to do anything, please help!

.header .header-nav ul#nav-account ul.dropdown-menu, .header .header-nav ul#nav-library ul.dropdown-menu {     z-index: 10000; } 

IE9, Chrome, FF and other modern no headache browsers: enter image description here


IE7 >:(
enter image description here

HTML

<div class="header-nav">  <ul id="nav-account" role="navigation" class="pull-right">      <!-- Language Dropdown Button -->     <li id="language-btn">         <a href="#" id="drop1" class="dropdown-toggle" data-toggle="dropdown">English</a>         <img src="img/header-small-down-arrow.png" alt="grey triangle"/><!-- <span class="grey_triangle"></span>-->          <!-- Language Dropdown Menu-->         <ul class="dropdown-menu" role="menu" aria-labelledby="drop1">             <li role="presentation"><a role="menuitem" tabindex="-1" href="#">English</a></li>             <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Spanish</a></li>             <li role="presentation"><a role="menuitem" tabindex="-1" href="#">German</a></li>             <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Japanese</a></li>             <li role="presentation"><a role="menuitem" tabindex="-1" href="#">Chinese</a></li>         </ul>     </li>      <!-- User Dropdown Button -->     <li id="account-btn">         <a href="#" id="drop2" class="dropdown-toggle" data-toggle="dropdown">Logout</a>         <img src="img/header-small-down-arrow.png" alt="grey triangle"/>         <!-- <span class="grey_triangle"></span> -->          <!-- User Dropdown Menu-->         <ul class="dropdown-menu" role="menu" aria-labelledby="drop2">             <li role="presentation"><a role="menuitem" tabindex="-1" href="http://google.com">Logout</a></li>             <li role="presentation"><a role="menuitem" tabindex="-1" href="#anotherAction">Account</a></li>         </ul>     </li> </ul> 
like image 994
Leon Gaban Avatar asked Apr 22 '13 14:04

Leon Gaban


People also ask

How Align drop down menu in Bootstrap Center?

You need to put the dropdown menu and the toggle button inside a . btn-group . Also, Bootstrap provides the . text-center property to align the contents.

How do I change the position of a drop down menu in HTML?

HTML) Use any element to open the dropdown content, e.g. a <span>, or a <button> element. Use a container element (like <div>) to create the dropdown content and add whatever you want inside of it. Wrap a <div> element around the elements to position the dropdown content correctly with CSS.

Why dropdown menu is not working in Bootstrap?

Solution : The dropdown should be toggled via data attributes or using javascript. In the above program, we have forgotten to add a data attribute so the dropdown is not working. So add data-bs-toggle="dropdown" to toggle the dropdown.


1 Answers

Its a stacking context issue!

Even though you are using z-index on the dropdown, it is only relative to elements in the same stacking context. You need to add a z-index and a position to a parent element in order to get this to work. In this case I would recommend the header-top div

like image 138
Blake Plumb Avatar answered Sep 19 '22 16:09

Blake Plumb