Free Online CSS Navbar Generator with Sticky Option
Build a horizontal navigation bar and see it in a strip that actually scrolls. Set the height, padding, background and border, make it sticky with a shadow that appears on scroll, place the links right or centred, choose an underline or pill indicator, and add a call to action button.
Scroll this strip. If the bar is set to sticky it stays at the top of the strip and the shadow appears once you have moved a few pixels.
The shadow is a class that script adds, because CSS on its own cannot tell whether the page has been scrolled. The few lines needed are in the output.
The links are real anchors, so hover them and press Tab to reach them. The first one carries the active class.
Everything below is here only to give the strip something to scroll.
A sticky bar costs you its full height on every screen, which matters most on a phone held in one hand.
Keep scrolling.
Almost there.
End of the strip.
Enjoying WizTools123? Help keep our server infrastructure 100% free and open for everyone.
How to Build a CSS Navigation Bar
A few steps, and nothing is uploaded.
What to Know About Navigation Bars
Including why sticky quietly stops working.
overflow: hidden, auto or scroll anywhere up the chain becomes that ancestor, so the bar sticks inside a box you cannot see instead of to the viewport. Walk up the parents and check. The other requirement is easy to miss too: sticky needs an offset, so top: 0 has to be there or nothing happens at all.
is-stuck class and something has to add that class. The output includes a scroll listener that does it, and mentions the alternative, which is an IntersectionObserver on a one pixel sentinel above the bar. Both are small. The preview here uses the listener on the scrolling strip.
Key Features & Capabilities
What this tool does, and what it deliberately does not.
About the CSS Navbar Generator
A navigation bar is a flexbox row, a handful of link states and one decision about whether it follows the reader down the page. None of that is difficult, and all of it is fiddly enough that people reach for a framework and inherit a hundred rules to override. This page writes the twenty or so rules the bar actually needs, with your own class name, so the result is something you can read and edit rather than fight.
The preview is a real bar inside a strip that scrolls on its own. That matters for sticky: a static picture of a bar tells you nothing about whether it will stay put, whereas scrolling the strip shows the bar hold its position and the shadow appear. The generated CSS is applied through a stylesheet in the page, so hover states, the focus ring and the indicator are the real rules running, not an imitation of them.
Two parts are honest about needing help from elsewhere. The scroll shadow cannot be done in CSS alone, because CSS has no way to ask how far the page has been scrolled, so the tool writes the rule and hands you the four line listener that toggles the class. And there is no mobile behaviour here at all: a real header on a phone needs a toggle button and a panel, which is a different control with its own accessibility requirements.
Frequently Asked Questions
Sticky position, the scroll shadow, centring and small screens.
aria-current="page" to the current link, which is what tells a screen reader where it is; the class only changes the appearance. Both are in the generated markup comment.