A navigation bar is a navigation header that is placed at (usually) 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).
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.
The .navbar-brand class is used to highlight the brand/logo/project name of your page.
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.
When using the .navbar-brand class on images, Bootstrap 4 will automatically style the image to fit the navbar. I am not sure what this styling is. The width has to be manually specified.
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.
Tip: You can also remove the .navbar-expand-md class to ALWAYS hide navbar links and display the toggler button.
This example adds a dropdown menu in the navbar.
Use the .form-inline class to align form elements side by side inside the navbar.
Use the .input-groupaddon class to attach an icon or help text
Use the .navbar-text class to vertical align any elements inside the navbar that are not links (ensures proper padding).