The new bootstrap navbar does not support more than 2 levels of menu. That is to say the "dropdown-submenu" css class has been removed since Bootstrap 3.0. In order to work around that issue one can add the missing piece into another css file.
Menu HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--Third level menu--> | |
<li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Warranty <b class="caret"></b></a> | |
<ul class="dropdown-menu"> | |
<li>@Html.ActionLink("SMS Registration", "Index", "SMSRegistration")</li> | |
<li class="dropdown-submenu"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Online Registration</a> | |
<ul class="dropdown-menu"> | |
<li><a href="#">Register New Sticker</a></li> | |
<li>@Html.ActionLink("Register Old Sticker", "Index", "OnlineRegistration")</li> | |
</ul> | |
</li> | |
</ul> | |
</li> |
Menu CSS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.dropdown-submenu { | |
position: relative; | |
} | |
.dropdown-submenu > .dropdown-menu { | |
top: 0; | |
left: 100% !important; | |
margin-top: -6px; | |
margin-left: -1px; | |
-webkit-border-radius: 0 6px 6px 6px; | |
-moz-border-radius: 0 6px 6px 6px; | |
border-radius: 0 6px 6px 6px; | |
} | |
.dropdown-submenu:hover > .dropdown-menu { | |
display: block !important; | |
float:right !important; | |
} | |
.dropdown-submenu > a:after { | |
display: block; | |
content: " "; | |
float: right; | |
width: 0; | |
height: 0; | |
border-color: transparent; | |
border-style: solid; | |
border-width: 5px 0 5px 5px; | |
border-left-color: #cccccc; | |
margin-top: 5px; | |
margin-right: -10px; | |
} | |
.dropdown-submenu:hover > a:after { | |
border-left-color: #ffffff; | |
} | |
.dropdown-submenu.pull-left { | |
float: none; | |
} | |
.dropdown-submenu.pull-left > .dropdown-menu { | |
left: -100%; | |
margin-left: 10px; | |
-webkit-border-radius: 6px 0 6px 6px; | |
-moz-border-radius: 6px 0 6px 6px; | |
border-radius: 6px 0 6px 6px; | |
} |
Notice how the CSS is put in place. In certain scenario for example when we use a centered navbar, the "!important" command is important to override the Bootstrap original behavior for the third level menu to appear correctly.