Navbar

Bootstrap Navbar

Note: We are transitioning MDB4 to a legacy version and focusing on developing MDB5. While we'll continue to support for the transition period, we encourage you to migrate to MDB5. We're offering a huge discount on MDB5 PRO to help with your transition, enabling you to leverage the full potential of the latest version. You can find more information here.
upgrade with discount

Documentation and examples for Bootstrap’s powerful, responsive navigation header, the navbar. Includes support for branding, navigation, and more, including support for our collapse plugin.

MDB provides you with stylish Navbars, with distinctive and specific to Material Design details (such as shadows, living colors or charming wave effects triggered by clicking on the link). Apart from traditional, text links, Bootstraps Navbar might embed regular & social icons, dropdowns, avatars or search forms.


How it works

Here’s what you need to know before getting started with the navbar:

  • Navbars require a wrapping .navbar with .navbar-expand{-sm|-md|-lg|-xl} for responsive collapsing and color scheme classes.
  • Navbars and their contents are fluid by default. Use optional containers to limit their horizontal width.
  • Use our spacing and flex utility classes for controlling spacing and alignment within navbars.
  • Navbars are responsive by default, but you can easily modify them to change that. Responsive behavior depends on our Collapse JavaScript plugin.
  • Navbars are hidden by default when printing. Force them to be printed by adding .d-print to the .navbar. See the display utility class.
  • Ensure accessibility by using a <nav> element or, if using a more generic element such as a <div>, add a role="navigation" to every navbar to explicitly identify it as a landmark region for users of assistive technologies.

Read on for an example and list of supported sub-components.


Basic example

Here’s an example of all the sub-components included in a responsive light-themed navbar that automatically collapses at the lg (large) breakpoint.

        
            

        <!--Navbar-->
        <nav class="navbar navbar-expand-lg navbar-dark primary-color">

          <!-- Navbar brand -->
          <a class="navbar-brand" href="#">Navbar</a>

          <!-- Collapse button -->
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#basicExampleNav"
            aria-controls="basicExampleNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>

          <!-- Collapsible content -->
          <div class="collapse navbar-collapse" id="basicExampleNav">

            <!-- Links -->
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>

              <!-- Dropdown -->
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">Dropdown</a>
                <div class="dropdown-menu dropdown-primary" aria-labelledby="navbarDropdownMenuLink">
                  <a class="dropdown-item" href="#">Action</a>
                  <a class="dropdown-item" href="#">Another action</a>
                  <a class="dropdown-item" href="#">Something else here</a>
                </div>
              </li>

            </ul>
            <!-- Links -->

            <form class="form-inline">
              <div class="md-form my-0">
                <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
              </div>
            </form>
          </div>
          <!-- Collapsible content -->

        </nav>
        <!--/.Navbar-->

      
        
    

Supported content

Navbars come with built-in support for a handful of sub-components. Choose from the following as needed:

  • .navbar-brand for your company, product, or project name.

  • .navbar-nav for full-height and lightweight navigation (including support for dropdowns).

  • .navbar-toggler for use with our collapse plugin and other navigation-toggling behaviors.

  • .form-inline for any form controls and actions.

  • .navbar-text for adding vertically centered strings of text.

  • .collapse.navbar-collapse for grouping and hiding navbar contents by a parent breakpoint.

Brand

The .navbar-brand can be applied to most elements, but an anchor works best as some elements might require utility classes or custom styles.

        
            

        <!-- As a link -->
        <nav class="navbar navbar-dark primary-color">
          <a class="navbar-brand" href="#">Link</a>
        </nav>

        <br>

        <!-- As a heading -->
        <nav class="navbar navbar-light blue lighten-4">
          <span class="navbar-brand">Heading</span>
        </nav>
      
        
    

Navbar navigation links build on our .nav options with their own modifier class and require the use of toggler classes for proper responsive styling. Navigation in navbars will also grow to occupy as much horizontal space as possible, so to keep your navbar contents securely aligned.

Active states—with .active—to indicate the current page can be applied directly to .nav-links or their immediate parent .nav-items.

        
            

        <nav class="navbar navbar-expand-lg navbar-dark primary-color">
          <a class="navbar-brand" href="#">Navbar</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav"
            aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarNav">
            <ul class="navbar-nav">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>
              <li class="nav-item">
                <a class="nav-link disabled" href="#">Disabled</a>
              </li>
            </ul>
          </div>
        </nav>
      
        
    

Forms

You can place various form controls and components within a navbar with .form-inline. You can use a form control in a material style or a default bootstrap one.

        
            

        <nav class="navbar navbar-dark default-color">
          <form class="form-inline">
            <div class="md-form my-0">
              <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
            </div>
            <button class="btn btn-outline-white btn-md my-2 my-sm-0 ml-3" type="submit">Search</button>
          </form>
        </nav>

        <br>

        <!--Navbar-->
        <nav class="navbar navbar-dark default-color">
          <form class="form-inline my-2 my-lg-0 ml-auto">
            <input class="form-control" type="search" placeholder="Search" aria-label="Search">
            <button class="btn btn-outline-white btn-md my-2 my-sm-0 ml-3" type="submit">Search</button>
          </form>
        </nav>
        <!--/.Navbar-->

      
        
    

Text

Navbars may contain bits of text with the help of .navbar-text. This class adjusts vertical alignment and horizontal spacing for strings of text.

        
            

        <nav class="navbar navbar-dark indigo">
          <span class="navbar-text white-text">
            Navbar text with an inline element
          </span>
        </nav>

      
        
    

Mix and match with other components and utilities as needed.

        
            

        <nav class="navbar navbar-expand-lg navbar-dark indigo">
          <a class="navbar-brand" href="#">Navbar w/ text</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText"
            aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarText">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>
            </ul>
            <span class="navbar-text white-text">
              Navbar text with an inline element
            </span>
          </div>
        </nav>

      
        
    

Images

Adding images to the .navbar-brand will likely always require custom styles or utilities to properly size. Here are some examples to demonstrate.

        
            

        <!-- Just an image -->
        <nav class="navbar navbar-dark primary-color">
          <a class="navbar-brand" href="#">
            <img src="https://mdbootstrap.com/img/logo/mdb-transparent.webp" height="30" alt="mdb logo">
          </a>
        </nav>

      
        
    
        
            

        <!-- Just an image -->
        <nav class="navbar navbar-dark primary-color">
          <a class="navbar-brand" href="#">
            <img src="https://mdbootstrap.com/img/logo/mdb-transparent.webp" height="30" alt="mdb logo">
          </a>
        </nav>

      
        
    
        
            

        <!-- Image and text -->
        <nav class="navbar navbar-dark primary-color">
          <a class="navbar-brand" href="#">
            <img src="https://mdbootstrap.com/img/logo/mdb-transparent.webp" height="30" class="d-inline-block align-top"
              alt="mdb logo"> Bootstrap
          </a>
        </nav>

      
        
    

Heading

Align the contents of your inline forms with utilities as needed.

        
            

        <nav class="navbar navbar-dark default-color justify-content-between">
          <a class="navbar-brand" href="#">Navbar</a>
          <form class="form-inline my-1">
            <div class="md-form form-sm my-0">
              <input class="form-control form-control-sm mr-sm-2 mb-0" type="text" placeholder="Search"
                aria-label="Search">
            </div>
            <button class="btn btn-outline-white btn-sm my-0" type="submit">Search</button>
          </form>
        </nav>

      
        
    

Input groups work, too:

        
            

        <nav class="navbar navbar-dark default-color">
          <form class="form-inline">
            <div class="md-form input-group my-0">
              <div class="input-group-prepend">
                <span class="input-group-text" id="basic-addon11">@</span>
              </div>
              <input type="text" class="form-control" placeholder="Username" aria-label="Username"
                aria-describedby="basic-addon11">
            </div>
          </form>
        </nav>

      
        
    

Various buttons are supported as part of these navbar forms, too. This is also a great reminder that vertical alignment utilities can be used to align different sized elements.

        
            

        <nav class="navbar navbar-dark indigo">
          <form class="form-inline">
            <button class="btn btn-outline-white" type="button">Main button</button>
            <button class="btn btn-sm align-middle btn-outline-white" type="button">Smaller button</button>
          </form>
        </nav>

      
        
    

Social icons

You can add social media icons to the navbar to improve communication with visitors.

        
            

        <!--Navbar -->
        <nav class="mb-1 navbar navbar-expand-lg navbar-dark default-color">
          <a class="navbar-brand" href="#">Navbar</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent-333"
            aria-controls="navbarSupportedContent-333" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarSupportedContent-333">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-333" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">Dropdown
                </a>
                <div class="dropdown-menu dropdown-default" aria-labelledby="navbarDropdownMenuLink-333">
                  <a class="dropdown-item" href="#">Action</a>
                  <a class="dropdown-item" href="#">Another action</a>
                  <a class="dropdown-item" href="#">Something else here</a>
                </div>
              </li>
            </ul>
            <ul class="navbar-nav ml-auto nav-flex-icons">
              <li class="nav-item">
                <a class="nav-link waves-effect waves-light">
                  <i class="fab fa-twitter"></i>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link waves-effect waves-light">
                  <i class="fab fa-google-plus-g"></i>
                </a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-333" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">
                  <i class="fas fa-user"></i>
                </a>
                <div class="dropdown-menu dropdown-menu-right dropdown-default"
                  aria-labelledby="navbarDropdownMenuLink-333">
                  <a class="dropdown-item" href="#">Action</a>
                  <a class="dropdown-item" href="#">Another action</a>
                  <a class="dropdown-item" href="#">Something else here</a>
                </div>
              </li>
            </ul>
          </div>
        </nav>
        <!--/.Navbar -->

      
        
    

Avatar

An avatar in the navbar will improve the visibility of the logged in user on your site.

        
            

        <!--Navbar -->
        <nav class="mb-1 navbar navbar-expand-lg navbar-dark orange lighten-1">
          <a class="navbar-brand" href="#">Navbar</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent-555"
            aria-controls="navbarSupportedContent-555" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarSupportedContent-555">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>
            </ul>
            <ul class="navbar-nav ml-auto nav-flex-icons">
              <li class="nav-item avatar">
                <a class="nav-link p-0" href="#">
                  <img src="https://mdbootstrap.com/img/Photos/Avatars/avatar-5.webp" class="rounded-circle z-depth-0"
                    alt="avatar image" height="35">
                </a>
              </li>
            </ul>
          </div>
        </nav>
        <!--/.Navbar -->

      
        
    

Avatar dropdown MDB Pro component"

Add a dropdown to the avatar, and you'll get more diverse navigation options.

        
            

        <!--Navbar -->
        <nav class="mb-1 navbar navbar-expand-lg navbar-dark secondary-color lighten-1">
          <a class="navbar-brand" href="#">Navbar</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent-555"
            aria-controls="navbarSupportedContent-555" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarSupportedContent-555">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">Home
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Features</a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">Pricing</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-555" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">Dropdown
                </a>
                <div class="dropdown-menu dropdown-secondary" aria-labelledby="navbarDropdownMenuLink-555">
                  <a class="dropdown-item" href="#">Action</a>
                  <a class="dropdown-item" href="#">Another action</a>
                  <a class="dropdown-item" href="#">Something else here</a>
                </div>
              </li>
            </ul>
            <ul class="navbar-nav ml-auto nav-flex-icons">
              <li class="nav-item">
                <a class="nav-link waves-effect waves-light">1
                  <i class="fas fa-envelope"></i>
                </a>
              </li>
              <li class="nav-item avatar dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-55" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">
                  <img src="https://mdbootstrap.com/img/Photos/Avatars/avatar-2.webp" class="rounded-circle z-depth-0"
                    alt="avatar image">
                </a>
                <div class="dropdown-menu dropdown-menu-lg-right dropdown-secondary"
                  aria-labelledby="navbarDropdownMenuLink-55">
                  <a class="dropdown-item" href="#">Action</a>
                  <a class="dropdown-item" href="#">Another action</a>
                  <a class="dropdown-item" href="#">Something else here</a>
                </div>
              </li>
            </ul>
          </div>
        </nav>
        <!--/.Navbar -->

      
        
    

Social buttons

Links with full social media names improve the legibility of the navbar.

        
            

        <!--Navbar -->
        <nav class="mb-1 navbar navbar-expand-lg navbar-dark info-color">
          <a class="navbar-brand" href="#">Navbar</a>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent-4"
            aria-controls="navbarSupportedContent-4" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
          <div class="collapse navbar-collapse" id="navbarSupportedContent-4">
            <ul class="navbar-nav ml-auto">
              <li class="nav-item active">
                <a class="nav-link" href="#">
                  <i class="fab fa-facebook-f"></i> Facebook
                  <span class="sr-only">(current)</span>
                </a>
              </li>
              <li class="nav-item">
                <a class="nav-link" href="#">
                  <i class="fab fa-instagram"></i> Instagram</a>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink-4" data-toggle="dropdown"
                  aria-haspopup="true" aria-expanded="false">
                  <i class="fas fa-user"></i> Profile </a>
                <div class="dropdown-menu dropdown-menu-right dropdown-info" aria-labelledby="navbarDropdownMenuLink-4">
                  <a class="dropdown-item" href="#">My account</a>
                  <a class="dropdown-item" href="#">Log out</a>
                </div>
              </li>
            </ul>
          </div>
        </nav>
        <!--/.Navbar -->

      
        
    

Multi-level navbar MDB Pro component

Helps you to expand the navbar with more options.

        
            
          <!--Navbar-->
          <nav class="navbar navbar-expand-lg navbar-dark primary-color">
            <!-- Navbar brand -->
            <a class="navbar-brand" href="#">Navbar</a>
            <!-- Collapse button -->
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#basicExampleNav"
              aria-controls="basicExampleNav" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>
            <!-- Collapsible content -->
            <div class="collapse navbar-collapse" id="basicExampleNav">
              <!-- Links -->
              <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                  <a class="nav-link" href="#">Home
                    <span class="sr-only">(current)</span>
                  </a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#">Features</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#">Pricing</a>
                </li>
                <!-- Dropdown -->
                <li class="nav-item dropdown multi-level-dropdown">
                  <a href="#" id="menu" data-toggle="dropdown" class="nav-link dropdown-toggle w-100">Dropdown</a>
                  <ul class="dropdown-menu mt-2 rounded-0 primary-color border-0 z-depth-1">
                    <li class="dropdown-item dropdown-submenu p-0">
                      <a href="#" data-toggle="dropdown" class="dropdown-toggle text-white w-100">Click Me Too! </a>
                      <ul class="dropdown-menu ml-2 rounded-0 primary-color border-0 z-depth-1">
                        <li class="dropdown-item p-0">
                          <a href="#" class="text-white w-100">Hey</a>
                        </li>
                        <li class="dropdown-item p-0">
                          <a href="#" class="text-white w-100">Hi</a>
                        </li>
                        <li class="dropdown-item dropdown-submenu p-0">
                          <a href="#" data-toggle="dropdown" class="dropdown-toggle text-white w-100">Hello </a>
                          <ul class="dropdown-menu mr-2 rounded-0 primary-color border-0 z-depth-1 r-100 ">
                            <li class="dropdown-item p-0">
                              <a href="#" class="text-white w-100">Some</a>
                            </li>
                            <li class="dropdown-item p-0">
                              <a href="#" class="text-white w-100">Text</a>
                            </li>
                          </ul>
                        </li>
                      </ul>
                    </li>
                    <li class="dropdown-item dropdown-submenu">
                      <a href="#" data-toggle="dropdown" class="dropdown-toggle text-white w-100">Click me </a>
                      <ul class="dropdown-menu mr-2 rounded-0  primary-color border-0 z-depth-1 r-100 ">
                        <li class="dropdown-item p-0">
                          <a href="#" class="text-white w-100">How</a>
                        </li>
                        <li class="dropdown-item p-0">
                          <a href="#" class="text-white w-100">are</a>
                        </li>
                        <li class="dropdown-item p-0">
                          <a href="#" class="text-white w-100">you </a>
                        </li>
                      </ul>
                    </li>
                  </ul>
                </li>
              </ul>
              <!-- Links -->
              <form class="form-inline">
                <div class="md-form my-0">
                  <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
                </div>
              </form>
            </div>
            <!-- Collapsible content -->
          </nav>
          <!--/.Navbar-->
        
        
    

Color schemes

Theming the navbar has never been easier thanks to the combination of a simple link color modifier class and background-color utilities. Put another way, you specify light or dark and apply a background color.

You can choose one of over 300 colors that form our material palette .

        
            

          <!--/.Navbar danger color-->
          <nav class="navbar navbar-dark danger-color">
            ...
          </nav>
          <!--/.Navbar danger color-->

          <!--/.Navbar secondary color-->
          <nav class="navbar navbar-dark secondary-color">
            ...
          </nav>
          <!--/.Navbar secondary color-->

          <!--/.Navbar default color-->
          <nav class="navbar-light default-color lighten-4">
            ...
          </nav>
          <!--/.Navbar default color-->

        
        
    

If you want to use a light background you should apply .navbar-light class to the Navbar, to provide a proper contrast for the links.

        
            

          <!--Navbar-->
          <nav class="navbar navbar-expand-lg navbar-light warning-color lighten-5">
            [..]
          </nav>
          <!--/.Navbar-->

        
        
    

Containers

Although it’s not required, you can wrap a navbar in a .container to center it on a page or add one within it to only center the contents of a fixed or static top navbar

        
            

          <div class="container">
            <nav class="navbar navbar-expand-lg navbar-dark indigo">
              <a class="navbar-brand" href="#">Navbar</a>
            </nav>
          </div>

        
        
    

When the container is within your navbar, its horizontal padding is removed at breakpoints lower than your specified .navbar-expand{-sm|-md|-lg|-xl} class. This ensures we’re not doubling up on padding unnecessarily on lower viewports when your navbar is collapsed.

        
            

          <nav class="navbar navbar-expand-lg navbar-dark indigo">
            <div class="container">
              <a class="navbar-brand" href="#">Navbar</a>
            </div>
          </nav>

        
        
    

Placement

Use our position utilities to place navbars in non-static positions. Choose from fixed to the top, fixed to the bottom, or stuck to the top (scrolls with the page until it reaches the top, then stays there). Fixed navbars use position: fixed, meaning they’re pulled from the normal flow of the DOM and may require custom CSS (e.g., padding-top on the <body>) to prevent overlap with other elements.

Also note that .sticky-top uses position: sticky, which isn’t fully supported in every browser .

Default

        
            

          <nav class="navbar navbar-light bg-light">
            <a class="navbar-brand" href="#">Default</a>
          </nav>

        
        
    

Fixed top

        
            

          <nav class="navbar fixed-top navbar-light bg-light">
            <a class="navbar-brand" href="#">Fixed top</a>
          </nav>

        
        
    

Fixed bottom

        
            

          <nav class="navbar fixed-bottom navbar-dark indigo">
            <a class="navbar-brand" href="#">Fixed bottom</a>
          </nav>

        
        
    

Sticky top

        
            

          <nav class="navbar sticky-top navbar-dark indigo">
            <a class="navbar-brand" href="#">Sticky top</a>
          </nav>

        
        
    

Responsive behaviors

Navbars can utilize .navbar-toggler, .navbar-collapse, and .navbar-expand{-sm|-md|-lg|-xl} classes to change when their content collapses behind a button. In combination with other utilities, you can easily choose when to show or hide particular elements.

For navbars that never collapse, add the .navbar-expand class on the navbar. For navbars that always collapse, don’t add any .navbar-expand classes.

Toggler

Navbar togglers are left-aligned by default, but should they follow a sibling element like a .navbar-brand, they’ll automatically be aligned to the far right. Reversing your markup will reverse the placement of the toggler. Below are examples of different toggle styles.

With no .navbar-brand shown in the lowest breakpoint:

        
            

          <nav class="navbar navbar-expand-lg navbar-dark indigo">
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01"
              aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse" id="navbarTogglerDemo01">
              <a class="navbar-brand" href="#">Hidden brand</a>
              <ul class="navbar-nav mr-auto mt-lg-0">
                <li class="nav-item active">
                  <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#">Link</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link disabled" href="#">Disabled</a>
                </li>
              </ul>
            </div>
          </nav>

        
        
    

With a brand name shown on the left and the toggler on the right:

        
            

          <nav class="navbar navbar-expand-lg navbar-dark indigo">
            <a class="navbar-brand" href="#">Navbar</a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo02"
              aria-controls="navbarTogglerDemo02" aria-expanded="false" aria-label="Toggle navigation">
              <span class="navbar-toggler-icon"></span>
            </button>

            <div class="collapse navbar-collapse" id="navbarTogglerDemo02">
              <ul class="navbar-nav mr-auto mt-lg-0">
                <li class="nav-item active">
                  <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                  <a class="nav-link" href="#">Link</a>
                </li>
                <li class="nav-item">
                  <a class="nav-link disabled" href="#">Disabled</a>
                </li>
              </ul>
            </div>
          </nav>

        
        
    

External content

Sometimes you want to use the collapse plugin to trigger hidden content elsewhere on the page. Because our plugin works on the id and data-target matching, that’s easily done!

        
            
          <div class="pos-f-t">
            <div class="collapse" id="navbarToggleExternalContent">
              <div class="bg-dark p-4">
                <h4 class="text-white">Collapsed content</h4>
                <span class="text-muted">Toggleable via the navbar brand.</span>
              </div>
            </div>
            <nav class="navbar navbar-dark bg-dark">
              <button class="navbar-toggler" type="button" data-toggle="collapse"
                data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent"
                aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
              </button>
            </nav>
          </div>

        
        
    

Scrolling navbar

By adding .scrolling-navbar class to your fixed-top navbar, you can give it a smooth animation when scrolling.

        
            

          <nav class="navbar navbar-expand-lg navbar-dark indigo fixed-top scrolling-navbar">
            [..]
          </nav>

        
        
    

Advanced navigation MDB Pro component

MDB provides you multiple useful, ready-to-use page layouts with various predefined navigation types.

Navigation layouts

Read more

Skins

Read more