Shane
Shane

Reputation: 5677

Dropdown margin in bootstrap navbar

How do I align the bootstrap navbar drop-down? The drop down always starts from the right corner, is it possible to set the starting point for the drop-down.

example

Here is the fiddle.

Both the menu when I click always starts from the right. Is it possible to move the first menu drop drown to some margin left? The drop down should start from the menu where its clicked rather than from entirely right.

Upvotes: 1

Views: 1523

Answers (2)

JofryHS
JofryHS

Reputation: 5874

Not sure why you are using Bootstrap 2.1, but you are missing .dropdown class on your <li> which suppose to have dropdown.

<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown">
    <b class="caret"></b>
  </a>
  <ul class="dropdown-menu">
    <li><a href="#">Action</a></li>
    <li><a href="#">Another action</a></li>
    <li><a href="#">Something else here</a></li>
    <li class="divider"></li>
    <li class="nav-header">Nav header</li>
    <li><a href="#">Separated link</a></li>
    <li><a href="#">One more separated link</a></li>
  </ul>
</li>

Upvotes: 1

Tushar
Tushar

Reputation: 4418

Add this CSS

CSS

.navbar .nav>li {
  position: relative;
}

DEMO

Upvotes: 3

Related Questions