I would like to open a dropdown menu (using Twitter Bootstrap) everytime I click on the brand of my navbar, so I tried this code:
<div class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="tabbable">
<div class="dropdown">
<a id="drop1" class="dropdown-toggle" data-toggle="dropdown" href="#menu">
<div class="brand">Brand</div>
</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="drop1">
<li><a href="#">Action</a></li>
</ul>
</div>
<ul class="nav">
<li>
<a href="#" data-toggle="tab">Item</a>
</li>
</ul>
</div>
</div>
</div>
Result: when I click on it, the menu appears, but it’s over the brand, not under. How to fix it?
Examples
- Standard version [OK]: http://jsfiddle.net/4rdPU/2/
- Standard version +
div class="brand"[Style problem]: http://jsfiddle.net/4rdPU/1/ - Brand version [Wrong menu position]: http://jsfiddle.net/4rdPU/3/
To properly render the dropdown, your brand must be a
.nav lielement. So just add the.brandclass to a standard dropdown.That will break your brand positioning, but you fan fix it with this simple CSS: