Home > Article > Web Front-end > Why is my Bootstrap navbar disappearing on smaller devices?
Bootstrap Navbar Disappearing on Smaller Devices
When creating a Bootstrap navbar, you may encounter hidden navigation and a missing hamburger icon on smaller screens. This is because the default navbar settings are designed for larger screens.
Solution
To resolve this issue, you need to add the appropriate class to your navbar. For Bootstrap 5, use the navbar-light or navbar-dark class.
<nav>
For Bootstrap 4 and earlier versions, use the navbar-default class. You can also set a background color for the navbar or darken the toggler icon as follows:
#navbar-primary .navbar-nav { background: #ededed; } .navbar-toggle .icon-bar { background-color: rgb(136, 136, 136); }
Once you have applied these changes, your navbar should display properly on all screen sizes.
The above is the detailed content of Why is my Bootstrap navbar disappearing on smaller devices?. For more information, please follow other related articles on the PHP Chinese website!