If you visit the official Bootstrap website at https://getbootstrap.com/docs/4.0/components/navbar/, you will find numerous examples of navigation bars.
The key concept here is the screen breakpoint. It determines when the hamburger
icon should be displayed.
In Bootstrap 4, this is controlled by the utility class navbar-expand-X
. If we want the hamburger icon to appear when the screen size is medium or smaller, we will use navbar-expand-md
on the parent nav
element.
<nav class="navbar navbar-expand-md navbar-light bg-light">...</nav>
Bootstrap provides default styles for the navbar, which we can customize according to our needs by applying our own custom styles.