Bootstrap Navbar Sticky on Scroll — How to Make a Sticky Navbar with Bootstrap
A Bootstrap Navbar Sticky on Scroll stays visible at the top of your page as you scroll down. Here’s how to make a sticky navbar with just one class.
How to Make a Bootstrap Navbar Sticky on Scroll
</p>
<nav class=”navbar navbar-expand-lg navbar-light bg-light sticky-top”> <a class=”navbar-brand” href=”#”>Brand</a> <!– Navbar content –> </nav>
How Bootstrap Navbar Sticky on Scroll Works
The sticky-top
class makes the Bootstrap Navbar Sticky on Scroll, so it stays fixed when the page scrolls.
Why Use Bootstrap Navbar Sticky on Scroll
A Bootstrap Navbar Sticky on Scroll improves navigation by keeping the menu always accessible.
Common Mistake in Bootstrap Navbar Sticky on Scroll
Don’t confuse fixed-top
and sticky-top
. fixed-top
stays fixed always; sticky-top
becomes sticky after its position is reached.
Pro Tip for Bootstrap Navbar Sticky on Scroll
Combine sticky-top
with shadows for better visibility over content.