I am making a navbar using bootstrap 5 and want to make the navbar items invisible until the screen size is below a certain width.
Asked
Active
Viewed 240 times
-1
-
It's explained clearly in the [Bootstrap Navbar docs](https://getbootstrap.com/docs/5.0/components/navbar/#responsive-behaviors) – Carol Skelly May 08 '21 at 12:27
2 Answers
1
Use media queries in css.
div {
display: none;
background: red;
}
@media screen and (max-width: 700px) {
div {
display: block;
}
}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<div>
You cant see me on big screens
</div>
Sample fiddle.

Prosy Arceno
- 2,616
- 1
- 8
- 32
0
You can look at the first navbar's html on this page of Bootstrap v5.0, for an in detail example. Basically you would be required to add a class navbar-expand-lg
(you can use any size acronym of bootstrap in place of lg
) to your nav
. And put all your navbar items in a div
with classes collapse navbar-collapse
.