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.
.nav component is built with flexbox and provide a strong foundation for building all types of navigation components. It includes some style overrides (for working with lists), some link padding for larger hit areas, and basic disabled styling.
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
display: flex, the nav links behave the same as nav items would, but without the extra markup.
Change the horizontal alignment of your nav with flexbox utilities. By default, navs are left-aligned, but you can easily change them to center or right aligned.
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.,
As always, vertical navigation is possible without
Takes the basic nav from above and adds the
Take that same HTML, but use
.nav’s contents to extend the full available width one of two modifier classes. To proportionately fill all available space with your
.nav-fill. Notice that all horizontal space is occupied, but not every nav item has the same width.
When using a
<nav>-based navigation, you can safely omit
.nav-item as only
.nav-link is required for styling
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.
Similar to the
.nav-fill example using a
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.
coreui.js file—to extend our navigational tabs and pills to create tabbable panes of local content, even via dropdown menus.
Dynamic tabbed interfaces, as described in the WAIARIA Authoring Practices, require
role="tabpanel", and additional
aria- attributes in order to convey their structure, functionality and current state to users of assistive technologies (such as screen readers). As a best practice, we recommend using
<button> elements for the tabs, as these are controls that trigger a dynamic change, rather than links that navigate to a new page or location.
Note that dynamic tabbed interfaces should not contain dropdown menus, as this causes both usability and accessibility issues. From a usability perspective, the fact that the currently displayed tab’s trigger element is not immediately visible (as it’s inside the closed dropdown menu) can cause confusion. From an accessibility point of view, there is currently no sensible way to map this sort of construct to a standard WAI ARIA pattern, meaning that it cannot be easily made understandable to users of assistive technologies.
To help fit your needs, this works with
<ul>-based markup, as shown above, or with any arbitrary “roll your own” markup. Note that if you’re using
<nav>, you shouldn’t add
role="tablist" directly to it, as this would override the element’s native role as a navigation landmark. Instead, switch to an alternative element (in the example below, a simple
<div>) and wrap the
<nav> around it.
The tabs plugin also works with pills.
And with vertical pills.