Basic Navbar Example

A navigation bar is a navigation header that is placed at the top of the page.

The navbar-expand-xl|lg|md|sm class determines when the navbar should stack vertically (on extra large, large, medium or small screens).

Bootstrap Example

Vertical Navbar Example

A navigation bar is a navigation header that is placed at the top of the page.

Bootstrap Example

Centered Navbar

Use the .justify-content-center class to center the navigation bar.

In this example, the navbar will be centered on medium, large and extra large screens. On small screens it will be displayed vertically and left-aligned (because of the .navbar-expand-sm class).

Bootstrap Example

Colored Navbar

Use any of the .bg-color classes to add a background color to the navbar.

Tip: Add a white text color to all links in the navbar with the .navbar-dark class, or use the .navbar-light class to add a black text color.

Bootstrap Example

Brand / Logo

The .navbar-brand class is used to highlight the brand/logo/project name of your page.

Bootstrap Example

Brand / Logo

When using the .navbar-brand class on images, Bootstrap 4 will automatically style the image to fit the navbar.

Bootstrap Example

Collapsible Navbar

In this example, the navigation bar is hidden on small screens and replaced by a button in the top right corner (try to re-size this window).

Only when the button is clicked, the navigation bar will be displayed.

Tip: You can also remove the .navbar-expand-md class to ALWAYS hide navbar links and display the toggler button.

Bootstrap Example

Navbar With Dropdown

This example adds a dropdown menu in the navbar.

Bootstrap Example

Navbar Forms

Use the .form-inline class to align form elements side by side inside the navbar.

Bootstrap Example

Navbar Forms

Use the .form-inline class to align form elements side by side inside the navbar.

Bootstrap Example

Navbar Text

Use the .navbar-text class to vertical align any elements inside the navbar that are not links (ensures proper padding).

Bootstrap Example

Top Fixed Navbar

A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

Scroll this page to see the effect

Bootstrap Example

Bottom Fixed Navbar

A fixed navigation bar stays visible in a fixed position (top or bottom) independent of the page scroll.

Scroll this page to see the effect

Bootstrap Example

Sticky Navbar

A sticky navigation bar stays fixed at the top of the page when you scroll past it.

Scroll this page to see the effect. Note: sticky-top does not work in IE11 and earlier.


Some example text. Some example text. Some example text. Some example text. Some example text.

Some example text. Some example text. Some example text. Some example text. Some example text.

Some example text. Some example text. Some example text. Some example text. Some example text.

Some example text. Some example text. Some example text. Some example text. Some example text.