Sar009
Sar009

Reputation: 2276

how to move dropdown-submenu to the top

i want to move a sub-menu to the top (equal to super menu) in bootstrap. Now the it looks like this now

i want to make it look like this enter image description here

i tried changing position and top but its not helping

my code now is as follow

<li id = "category-filter" class="dropdown">
    <a class="dropdown-toggle" data-toggle="dropdown" href="#">Account Settings</a>
        <ul class="dropdown-menu">
            <li><a href="#">Login</a></li>
            <li class="dropdown-submenu">
            <a tabindex="-1" href="#">More options</a>
            <ul class="dropdown-menu">
                <li><a tabindex="-1" href="#">Second level</a></li>
                <li class="dropdown-submenu">
                <a href="#">More..</a>
                <ul class="dropdown-menu">
                    <li><a href="#">3rd level</a></li>
                    <li><a href="#">3rd level</a></li>
                </ul>
            </li>
            <li><a href="#">Second level</a></li>
            <li><a href="#">Second level</a></li>
            </ul>
        </li>
        <li><a href="#">Register</a></li>
        <li class="divider"></li>
        <li><a href="#">Logout</a></li>
    </ul>
</li>

Upvotes: 0

Views: 2421

Answers (2)

RononDex
RononDex

Reputation: 4183

Add the following css code:

.nav ul li ul li ul {
  position: absolute;
  top: -26px !important;
}

This should do it

Upvotes: 0

DaniP
DaniP

Reputation: 38252

You may need to change the referent parent for the position:absolute, try this:

.dropdown-submenu {
    position:static;
}
.dropdown-submenu>.dropdown-menu {
    margin:0;
}

Check this Demo

Upvotes: 3

Related Questions