Layout with Fixed Navigation

Anchors the navigation bar to the top of the viewport so it remains accessible as users scroll through long pages — reducing friction for multi-section sites.

  • Documentation
  • SaaS marketing pages
  • long-form landing pages

What you’ll learn

  • How to recognize the structure
  • When it helps—and its trade-offs
  • How it adapts to smaller screens
  • A practical starting point
In this guide

Start with the shape

Read the figure

The numbered parts explain the decisions behind the composition. Read the relationships first; the colors are simply there to make the structure visible.

Layout anatomyPattern 10
Layout with Fixed Navigation: structure diagramKeep essential destinations available while the content scrolls. 1: Persistent bar. Essential navigation stays in a predictable viewport position. 2: Reserved offset. Space beneath the bar prevents the first content from being covered. 3: Scrolling content. The page and its anchor destinations remain readable below the bar.010203

Keep essential destinations available while the content scrolls.

  1. 01
    Persistent bar

    Essential navigation stays in a predictable viewport position.

  2. 02
    Reserved offset

    Space beneath the bar prevents the first content from being covered.

  3. 03
    Scrolling content

    The page and its anchor destinations remain readable below the bar.

How the pattern works

Fixed navigation stays attached to the viewport while the rest of the page moves. It helps on long pages or multi-section sites when people need frequent access to a small set of important destinations.

Fixed and sticky positioning are related but different. A fixed element leaves normal document flow, so the page needs a deliberate offset. A sticky element keeps its place in the flow and is constrained by its scrolling ancestor.

Where it fits—and what to consider

A useful choice when

  • A page is long enough to benefit from persistent navigation.
  • People frequently move between sections or site areas.
  • A small number of important destinations can stay visible.

Be deliberate about

  • A tall fixed bar can consume too much space on a small screen.
  • Anchor links and keyboard focus must not land underneath the bar.

Adapt the relationship, not just the size

A useful mobile layout preserves the task and content order while changing how the regions share space.

Layout with Fixed Navigation: narrow-screen adaptationKeep the bar compact, retain the most useful actions, and disclose secondary links. Recheck the reserved offset if the navigation height changes.
Small-screen structure

On wider screens

Keep the navigation height predictable and reserve that space in the page. Add scroll offsets to headings used as anchor targets.

On narrower screens

Keep the bar compact, retain the most useful actions, and disclose secondary links. Recheck the reserved offset if the navigation height changes.

Build the structure

  1. 01Choose which destinations deserve persistent space.
  2. 02Reserve the navigation height in the document layout.
  3. 03Test anchor jumps, text resizing, and keyboard focus.
A structural starting pointcss
:root { --nav-height: 4rem; }
.site-nav {
  position: fixed;
  inset: 0 0 auto;
  height: var(--nav-height);
  z-index: 50;
}
main { padding-top: var(--nav-height); }
[id] { scroll-margin-top: calc(var(--nav-height) + 1rem); }

Adapt the content, spacing, and breakpoints to your page. This example illustrates the structure, not a complete application.

A small design exercise

Try it yourself

Jump to the final heading of a long page. Check that the heading and keyboard focus remain visible below the fixed navigation, including after increasing text size.

See a worked example

Inspect a complete page using this pattern, then connect its content regions back to the annotated figure.

Open the example page
A worked example of layout with fixed navigationOpen full page (opens in a new tab)

Put the pattern into practice

Use the layout prompt as a starting brief, then adapt it to your real content and the decisions covered in this guide.

Read the AI layout prompt

Select the text below and copy it into your AI tool. Replace example content with your own.