Lightweight defaults Same markup, different classes
All nav components here—tabs, pills, and lists—share the same base markup and styles through the .nav
class.
Basic tabs
Take a regular <ul>
of links and add .nav-tabs
:
- <ul class="nav nav-tabs">
- <li class="active">
- <a href="#">Home</a>
- </li>
- <li><a href="#">...</a></li>
- <li><a href="#">...</a></li>
- </ul>
Basic pills
Take that same HTML, but use .nav-pills
instead:
- <ul class="nav nav-pills">
- <li class="active">
- <a href="#">Home</a>
- </li>
- <li><a href="#">...</a></li>
- <li><a href="#">...</a></li>
- </ul>
Disabled state
For any nav component (tabs, pills, or list), add .disabled
for gray links and no hover effects. Links will remain clickable, however, unless you remove the href
attribute. Alternatively, you could implement custom JavaScript to prevent those clicks.
- <ul class="nav nav-pills">
- ...
- <li class="disabled"><a href="#">Home</a></li>
- ...
- </ul>
Component alignment
To align nav links, use the .pull-left
or .pull-right
utility classes. Both classes will add a CSS float in the specified direction.
Stackable
As tabs and pills are horizontal by default, just add a second class, .nav-stacked
, to make them appear vertically stacked.
Stacked tabs
- <ul class="nav nav-tabs nav-stacked">
- ...
- </ul>
Stacked pills
- <ul class="nav nav-pills nav-stacked">
- ...
- </ul>
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">
- <a class="dropdown-toggle"
- data-toggle="dropdown"
- href="#">
- Dropdown
- <b class="caret"></b>
- </a>
- <ul class="dropdown-menu">
- <!-- links -->
- </ul>
- </li>
- </ul>
Pills with dropdowns
- <ul class="nav nav-pills">
- <li class="dropdown">
- <a class="dropdown-toggle"
- data-toggle="dropdown"
- href="#">
- Dropdown
- <b class="caret"></b>
- </a>
- <ul class="dropdown-menu">
- <!-- links -->
- </ul>
- </li>
- </ul>
Nav lists
A simple and easy way to build groups of nav links with optional headers. They’re best used in sidebars like the Finder in OS X.
Example nav list
Take a list of links and add class="nav nav-list"
:
- <ul class="nav nav-list">
- <li class="nav-header">List header</li>
- <li class="active"><a href="#">Home</a></li>
- <li><a href="#">Library</a></li>
- ...
- </ul>
Note
For nesting within a nav list, include class="nav nav-list"
on any nested <ul>
.
Horizontal dividers
Add a horizontal divider by creating an empty list item with the class .divider
, like so:
- <ul class="nav nav-list">
- ...
- <li class="divider"></li>
- ...
- </ul>
Tabbable nav
Bring your tabs to life with a simple plugin to toggle between content via tabs. Bootstrap integrates tabbable tabs in four styles: top (default), right, bottom, and left.
Tabbable example
To make tabs tabbable, create a .tab-pane
with unique ID for every tab and wrap them in .tab-content
.
I’m in Section 1.
Howdy, I’m in Section 2.
What up girl, this is Section 3.
- <div class="tabbable"> <!-- Only required for left/right tabs -->
- <ul class="nav nav-tabs">
- <li class="active"><a href="#tab1" data-toggle="tab">Section 1</a></li>
- <li><a href="#tab2" data-toggle="tab">Section 2</a></li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane active" id="tab1">
- <p>I'm in Section 1.</p>
- </div>
- <div class="tab-pane" id="tab2">
- <p>Howdy, I'm in Section 2.</p>
- </div>
- </div>
- </div>
Fade in tabs
To make tabs fade in, add .fade
to each .tab-pane
.
Requires jQuery plugin
All tabbable tabs are powered by our lightweight jQuery plugin. Read more about how to bring tabbable tabs to life on the JavaScript docs page.
Tabbable in any direction
Tabs on the bottom
Flip the order of the HTML and add a class to put tabs on the bottom.
I’m in Section A.
Howdy, I’m in Section B.
What up girl, this is Section C.
- <div class="tabbable tabs-below">
- <div class="tab-content">
- ...
- </div>
- <ul class="nav nav-tabs">
- ...
- </ul>
- </div>
Tabs on the left
Swap the class to put tabs on the left.
I’m in Section A.
Howdy, I’m in Section B.
What up girl, this is Section C.
- <div class="tabbable tabs-left">
- <ul class="nav nav-tabs">
- ...
- </ul>
- <div class="tab-content">
- ...
- </div>
- </div>
Tabs on the right
Swap the class to put tabs on the right.
I’m in Section A.
Howdy, I’m in Section B.
What up girl, this is Section C.
- <div class="tabbable tabs-right">
- <ul class="nav nav-tabs">
- ...
- </ul>
- <div class="tab-content">
- ...
- </div>
- </div>