Navigation Bar Examples

Use these reference examples to build a navigation bar with the Bootstrap markup used in this theme. Start with the basic structure below, then add only the components your navigation needs.

Basic navbar

A basic navbar is static by default, so it scrolls with the page. Place it within a .container to use the site’s content width.

<div class="navbar">
  <div class="navbar-inner">
    <a class="brand" href="#">Title</a>
    <ul class="nav">
      <li class="active"><a href="#">Home</a></li>
      <li><a href="#">Link</a></li>
      <li><a href="#">Link</a></li>
    </ul>
  </div>
</div>

Navbar components

Brand link

Add a simple anchor with the .brand class to display a project or site name.

<a class="brand" href="#">Project name</a>

Navigation links and dividers

Add navigation items in an unordered list with the .nav class. Apply .active to the current item. To separate links visually, place an empty .divider-vertical list item between them.

<ul class="nav">
  <li class="active"><a href="#">Home</a></li>
  <li class="divider-vertical"></li>
  <li><a href="#">Link</a></li>
</ul>

Forms and search

Use .navbar-form for a standard form. Add .pull-left or .pull-right to align a form, navigation list, or text in the navbar.

<form class="navbar-form pull-left">
  <input type="text" class="span2">
  <button type="submit" class="btn">Submit</button>
</form>

For a search field, use .navbar-search on the form and .search-query on the input.

<form class="navbar-search pull-left">
  <input type="text" class="search-query" placeholder="Search">
</form>

Dropdown menus

Dropdowns and dropups require the dropdown JavaScript plugin as well as the appropriate markup.

<ul class="nav">
  <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
      Account <b class="caret"></b>
    </a>
    <ul class="dropdown-menu">
      <li><a href="#">Action</a></li>
    </ul>
  </li>
</ul>

See the JavaScript dropdowns documentation for additional dropdown markup and usage information.

Display variations

Add one of these classes to the outer .navbar element to change how the navbar is positioned.

  • Fixed at the top: .navbar-fixed-top. Allow for the area behind it by adding at least 40px of top padding to the body.
  • Fixed at the bottom: .navbar-fixed-bottom.
  • Static at the top: .navbar-static-top. This creates a full-width bar that scrolls away with the page and does not require body padding changes.
  • Inverted appearance: .navbar-inverse.
<div class="navbar navbar-fixed-top">
  ...
</div>

Responsive navbar

For a collapsing navigation bar, add a toggle button and wrap the content that should collapse in .nav-collapse.collapse. The responsive navbar requires the collapse plugin and the responsive Bootstrap CSS file.

<div class="navbar">
  <div class="navbar-inner">
    <div class="container">
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="#">Project name</a>
      <div class="nav-collapse collapse">
        <!-- .nav, .navbar-search, .navbar-form, and other content -->
      </div>
    </div>
  </div>
</div>

Review the collapse plugin documentation and responsive Bootstrap CSS guidance before implementing a collapsing menu.

Common implementation questions

How do I show the current page in a navbar?

Apply the .active class to the list item for the current navigation link.

How do I align items in the navbar?

Use .pull-left or .pull-right on navigation links, forms, or text. These utility classes apply a float in the selected direction.

Do dropdown menus need additional functionality?

Yes. Navbar dropdowns require the dropdown JavaScript plugin in addition to the dropdown markup.

What is required for a collapsing responsive navbar?

Use a .btn-navbar toggle, place collapsible content in .nav-collapse.collapse, and ensure the collapse plugin and responsive Bootstrap CSS are available.

Back to Top
Product has been added to your cart
Compare (0)