Navs
Navs available in Bootstrap have shared markup, starting with the base .nav
class, as well as shared states. Swap modifier classes to switch between each style.
Tabs
Note the .nav-tabs
class requires the .nav
base class.
<ul class="nav nav-tabs">
<li class="active" role="presentation"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
Pills
Take that same HTML, but use .nav-pills
instead:
<ul class="nav nav-pills">
<li class="active" role="presentation"><a href="#">Home</a></li>
<li role="presentation"><a href="#">Profile</a></li>
<li role="presentation"><a href="#">Messages</a></li>
</ul>
Pills are also vertically stackable. Just add .nav-stacked
.
<ul class="nav nav-pills nav-stacked">
...
</ul>
Justified
Easily make tabs or pills equal widths of their parent at screens wider than 768px with .nav-justified
. On smaller screens, the nav links are stacked.
Justified navbar nav links are currently not supported.
<ul class="nav nav-tabs nav-justified">
...
</ul>
<ul class="nav nav-pills nav-justified">
...
</ul>
Disabled links
For any nav component (tabs or pills), add .disabled
for gray links and no hover effects.
<ul class="nav nav-pills">
...
<li class="disabled" role="presentation"><a href="#">Disabled link</a></li>
...
</ul>
Using dropdowns
Add dropdown menus with a little extra HTML and the dropdowns JavaScript plugin.
Tabs with dropdowns
<ul class="nav nav-tabs">
...
<li class="dropdown" role="presentation">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">
...
</ul>
</li>
...
</ul>
Pills with dropdowns
<ul class="nav nav-pills">
...
<li class="dropdown" role="presentation">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
Dropdown <span class="caret"></span>
</a>
<ul class="dropdown-menu">
...
</ul>
</li>
...
</ul>