Sticky header

Also called sticky navbar, sticky nav, or fixed header

A top bar that stays pinned to the top of the screen while the page scrolls underneath it, so navigation is always one click away.

What is Sticky header?

A sticky header keeps the logo, navigation, and main action in view as people scroll. Many sites add a small change once the page moves: a shadow or border appears, the background turns semi-transparent with a blur, or the bar shrinks a little. That change shows that content is sliding under the header.

In CSS it takes two lines: position: sticky and top: 0. The header stays in the normal page flow until it reaches the top of the screen, then pins there. position: fixed also pins it, but takes it out of the flow, so the page needs extra top padding to keep the header from covering the first lines of content.

Keep it short, about 56 to 64px, since it takes space permanently, especially on phones. If sticky seems to do nothing, check the parents: an ancestor with overflow: hidden or overflow: auto becomes the box it sticks inside. Give the header a z-index so cards and images pass beneath it, and set scroll-padding-top so in-page links do not land under it.

Often confused with

Scroll pinning
Scroll pinning holds a section in place for a stretch of scrolling while an animation plays, then lets it go. A sticky header stays pinned for the whole page.
All terms

Scroll pinning

A scroll effect that holds a section in place while its content animates through several states, then releases it to scroll away.

Glassmorphism

A visual style where panels look like frosted glass: translucent, blurred backgrounds with a thin light border over colorful shapes.

Z-index

A CSS property that decides which element appears on top when elements overlap, with higher numbers sitting closer to the viewer.

Overflow

A CSS property that decides what happens when content is bigger than its box: spill out, get clipped, or scroll inside it.