Sticky header

A nav bar that stays pinned to the top of the screen while the rest of the page scrolls underneath it.

menu that follows you downbar that stays putfixed navfixed headerfloating navbarheader that stays on screen when scrollingpinned top barsticky navbarnav that doesn't scroll away

See it

Live demo coming soon

What it is

A sticky header is a nav bar that stays pinned to the top of the viewport while the page scrolls under it. Two CSS mechanisms do it, and the difference matters: 'position: sticky' leaves the header in the document flow and only pins once you scroll past it, while 'position: fixed' pulls it out of flow entirely, so you owe the page manual top padding or the first section hides behind it.

Worth it when navigation is used mid-page: long docs, dashboards, checkout flows, anything with a persistent search or CTA. Common refinements are shrinking the bar after the first scroll, adding a background and border only once it leaves the top (a transparent header over the hero, solid after), and hide-on-scroll-down / show-on-scroll-up so reading gets the full screen back.

Gotcha: anchor links land underneath it. Jump to #pricing and the heading sits behind the bar, because the browser scrolls the target to y=0. Fix it with 'scroll-margin-top' on the targets or 'scroll-padding-top' on the root, matched to the header height. Also keep it short (56 to 64px): on a phone in landscape, a tall sticky header plus the browser chrome can eat a third of the screen. And watch the ancestors: an 'overflow' value of hidden, scroll, or auto on a parent makes that parent the scrolling box the header sticks inside, so depending on that box's height the header either pins to the wrong thing or scrolls away with it instead of staying at the top of the viewport.

Ask AI for it

Make the site header sticky: 'position: sticky; top: 0' with a z-index above page content, 64px tall on desktop and 56px on mobile. Start it transparent, then pull the hero upward by the header height with a negative top margin and add the same amount of top padding inside the hero, so the hero background extends behind the header without the content sliding under it. After 24px of scrolling, fade in a solid background with a subtle bottom border and backdrop blur. Add 'scroll-padding-top' on the html element equal to the header height so anchor links don't land behind the bar, and keep every ancestor of the header free of 'overflow' values that would make it the scrolling box.

You might have meant

sticky footersticky sidebarpage anatomyabove the foldhero section