2.290539 ETH / 22393.74 USD

Overview

Navigation available in Bootstrap share general markup and styles, from the base .nav class to the active
and disabled states. Swap modifier classes to switch between each style.

Example
Code Example
    <ul class="nav">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

Classes are used throughout, so your markup can be super flexible. Use <ul>s like above, <ol> if the order of your items is important, or roll your own with a <nav> element. Because the .nav uses display: flex, the nav links behave the same as nav items would, but without the extra markup.

Code Example
    <nav class="nav">        <a class="nav-link active" aria-current="page" href="#">Active</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link disabled">Disabled</a>    </nav>
Alignment styles

Change the style of .navs component with modifiers and utilities. Mix and match as needed, or build your own.

By default, navs are left-aligned, but you can easily change them to center or right aligned.

Centered with .justify-content-center:


Right-aligned with .justify-content-end:

Code Example
    <ul class="nav justify-content-center">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>    <ul class="nav justify-content-end">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>
Vertical

Stack your navigation by changing the flex item direction with the .flex-column utility. Need to stack them on some viewports but not others? Use the responsive versions (e.g., .flex-sm-column ).

Code Example
    <ul class="nav flex-column">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

As always, vertical navigation is possible without <ul>s, too.

Code Example
    <nav class="nav flex-column">        <a class="nav-link active" aria-current="page" href="#">Active</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link disabled">Disabled</a>    </nav>
Tabs

Takes the basic nav from above and adds the .nav-tabs class to generate a tabbed interface.

Code Example
    <ul class="nav nav-tabs">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

For pills. Take that same HTML, but use .nav-pills instead:

Fill and justify

Force your .nav's contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your .nav-items, use .nav-fill.
Notice that all horizontal space is occupied, but not every nav item has the same width.

Code Example
    <ul class="nav nav-pills nav-fill">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Much longer nav link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

When using a <nav>-based navigation, you can safely omit .nav-item as only .nav-link is required for styling <a> elements.

Code Example
    <nav class="nav nav-pills nav-fill">        <a class="nav-link active" aria-current="page" href="#">Active</a>        <a class="nav-link" href="#">Much longer nav link</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link disabled">Disabled</a>    </nav>

For equal-width elements, use .nav-justified. All horizontal space will be occupied by nav links, but unlike the .nav-fill above, every nav item will be the same width.

Code Example
    <ul class="nav nav-pills nav-justified">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Much longer nav link</a>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

Similar to the .nav-fill example using a <nav>-based navigation.

Code Example
    <nav class="nav nav-pills nav-justified">        <a class="nav-link active" aria-current="page" href="#">Active</a>        <a class="nav-link" href="#">Much longer nav link</a>        <a class="nav-link" href="#">Link</a>        <a class="nav-link disabled">Disabled</a>    </nav>
Working with flex utilities

If you need responsive nav variations, consider using a series of flexbox utilities. While more verbose, these utilities offer greater customization across responsive breakpoints. In the example below, our nav will be stacked on the lowest breakpoint, then adapt to a horizontal layout that fills the available width starting from the small breakpoint.

Code Example
    <nav class="nav nav-pills flex-column flex-sm-row">        <a class="flex-sm-fill text-sm-center nav-link active" aria-current="page" href="#">Active</a>        <a class="flex-sm-fill text-sm-center nav-link" href="#">Longer nav link</a>        <a class="flex-sm-fill text-sm-center nav-link" href="#">Link</a>        <a class="flex-sm-fill text-sm-center nav-link disabled">Disabled</a>    </nav>
Tabs with dropdowns
Code Example
    <ul class="nav nav-tabs">        <li class="nav-item">          <a class="nav-link active" aria-current="page" href="#">Active</a>        </li>        <li class="nav-item dropdown">          <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">              <span>Dropdown</span><em class="ni ni-chevron-down icon"></em>          </a>          <div class="dropdown-menu">            <ul class="link-list-opt">                <li><a href="#">Action</a></li>                <li><a href="#">Another action</a></li>                <li><a href="#">Something else here</a></li>                <li><hr class="dropdown-divider"></li>                <li><a href="#">Separated link</a></li>            </ul>          </div>        </li>        <li class="nav-item">          <a class="nav-link" href="#">Link</a>        </li>        <li class="nav-item">          <a class="nav-link disabled">Disabled</a>        </li>    </ul>

For pills. Take that same HTML, but use .nav-pills instead:

JavaScript behavior

This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

Code Example
    <ul class="nav nav-tabs" id="myTab" role="tablist">        <li class="nav-item" role="presentation">          <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">Home</button>        </li>        <li class="nav-item" role="presentation">          <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">Profile</button>        </li>        <li class="nav-item" role="presentation">          <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact" type="button" role="tab" aria-controls="contact" aria-selected="false">Contact</button>        </li>      </ul>      <div class="tab-content mt-3 small" id="myTabContent">        <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">            <p>This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.</p>        </div>        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">            <p>This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.</p>        </div>        <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">            <p>This is some placeholder content the Contact tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.</p>        </div>      </div>

For pills. Take that same HTML, but use .nav-pills instead:

And with vertical pills.

This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation

This is some placeholder content the Messages tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation

This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.

Code Example
  <div class="row g-gs">    <div class="col-md-2">        <div class="nav flex-column nav-pills m-0" id="v-pills-tab" role="tablist" aria-orientation="vertical">            <button class="nav-link active" id="v-pills-home-tab" data-bs-toggle="pill" data-bs-target="#v-pills-home" type="button" role="tab" aria-controls="v-pills-home" aria-selected="true">Home</button>            <button class="nav-link" id="v-pills-profile-tab" data-bs-toggle="pill" data-bs-target="#v-pills-profile" type="button" role="tab" aria-controls="v-pills-profile" aria-selected="false">Profile</button>            <button class="nav-link" id="v-pills-messages-tab" data-bs-toggle="pill" data-bs-target="#v-pills-messages" type="button" role="tab" aria-controls="v-pills-messages" aria-selected="false">Messages</button>            <button class="nav-link" id="v-pills-settings-tab" data-bs-toggle="pill" data-bs-target="#v-pills-settings" type="button" role="tab" aria-controls="v-pills-settings" aria-selected="false">Settings</button>        </div>    </div>    <div class="col-md-8">        <div class="tab-content" id="v-pills-tabContent">            <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">                <p>This is some placeholder content the Home tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.</p>            </div>            <div class="tab-pane fade" id="v-pills-profile" role="tabpanel" aria-labelledby="v-pills-profile-tab">                <p>This is some placeholder content the Profile tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation</p>            </div>            <div class="tab-pane fade" id="v-pills-messages" role="tabpanel" aria-labelledby="v-pills-messages-tab">                <p>This is some placeholder content the Messages tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation</p>            </div>            <div class="tab-pane fade" id="v-pills-settings" role="tabpanel" aria-labelledby="v-pills-settings-tab">                <p>This is some placeholder content the Settings tab's associated content. Clicking another tab will toggle the visibility of this one for the next. The tab JavaScript swaps classes to control the content visibility and styling. You can use it with tabs, pills, and any other .nav-powered navigation.</p>            </div>        </div>    </div></div>