Navigation
Sticky header
A header that stays at the top of its scroll container after reaching a specified position while the page continues scrolling beneath it.
How people describe it
- “top strip that stays visible while I scroll”
- “page heading stuck to the top as content moves”
- “navigation that follows me down the page”
Good for
- Keeping navigation available on long pages
- Retaining important page actions during scrolling
Don’t mix it up with
Describes a navigation component; it may scroll away or be placed inside a sticky header.
Accessibility checklist
- Do not obscure keyboard focus or anchor destinations
- Keep navigation targets at least 44px high
- Avoid large sticky regions that consume the screen when zoomed
Try it
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 1.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 2.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 3.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 4.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 5.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 6.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 7.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 8.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 9.
Scroll this box. The header stays pinned at the top while the page content moves underneath it. Section 10.
Scroll inside the box, not the page.
Settings
Colors
Pick, eyedrop, or generate a color, then choose Custom under Color above.
Passes AA · 6.9:1
Text color is chosen for you.
Prompt
Add a sticky header that stays visible on scroll without hiding focused content.
Rough estimate for prompt text only; actual counts vary by model and context.
<!-- Add this header near the start of body, outside a short or overflow-clipped ancestor. -->
<header style="position:sticky; top:0; z-index:10; background:Canvas; color:CanvasText">
<nav aria-label="Primary" style="display:flex; flex-wrap:wrap; gap:16px">
<a href="/" style="display:inline-flex; align-items:center; min-height:44px">Home</a>
<a href="/guides/" style="display:inline-flex; align-items:center; min-height:44px">Guides</a>
</nav>
</header>
<!-- Set page scroll-padding-top to the rendered header height, including when links wrap. -->