Why is the Bootstrap Navbar always collapsed? [duplicate]

Bootstrap 5 (update 2021)

As stated in the docs,

“Navbars require a wrapping .navbar with
.navbar-expand{-sm|-md|-lg|-xl|-xxl} for responsive collapsing”

Therefore, Bootstrap 5 Navbar is the same as the Bootstrap 4 Navbar and will be vertically “collapse” if you don’t include navbar-expand-*

Bootstrap 4 (original answer)

In Bootstrap 4, the navbar-expand* class is needed if you want the navbar to expand horizontally, otherwise it defaults to the mobile/collapsed version. Therefore, not including the navbar-expand* class makes the Navbar always collapsed.

See these navbar breakpoint examples

As of Bootstrap 4 beta, the navbar-toggleable-* classes have changed to navbar-expand-*. In your case navbar-toggleable-sm would change to navbar-expand-md.

Leave a Comment