Skip to content
IndexRequest a UIAboutContact

Sticky Footer Layout

A footer that sits at the bottom of the screen on short pages and moves down naturally on long ones.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Clean wireframe diagram comparing two phone-shaped page layouts side by side, the left labelled Without the fix with a short article and the footer floating in the middle of the screen with an empty gap below, the right labelled With the fix with the same short article and the footer attached to the bottom edge, thin outlines and soft grey fills, small arrows showing the main area stretching. Negative: gradients, clutter, text errors. Reduced motion: static diagram.

About this pattern

Definition

On a page with little content, a footer placed after it floats halfway up the screen and leaves an ugly gap below. A sticky footer layout makes the page at least as tall as the viewport and lets the main area absorb the extra space, so the footer sits at the bottom, then gets pushed down when content grows.

Purpose & UX principles

  • Make the page a flex column with min-height of 100vh (or 100dvh on mobile).
  • Give main flex: 1 so it grows to fill the free space.
  • The footer needs no fixed or absolute positioning, so it never covers content.
  • Test with very short and very long pages.

Interaction states

  • Choose how much content the page has, and toggle the fix.

Motion specification

  • The page re-flows instantly.
  • Reduced motion: no animation.

Responsive behaviour

  • Do not confuse this with a fixed footer, which stays on screen and covers content.
  • Use dvh so mobile browser bars do not create extra scroll.

Code

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Content"><button data-p="0" aria-pressed="true">Short page</button><button data-p="1" aria-pressed="false">Medium</button><button data-p="2" aria-pressed="false">Long</button></div><label class="sw"><input id="fx" type="checkbox" checked> Sticky footer fix</label><div class="vp"><div class="pg2" id="pg2"><header>Header</header><main id="mn"></main><footer>Footer</footer></div></div></div>

Related patterns

Holy Grail Three-column Layout

↗
Holy Grail Three-column LayoutLayout Structures

Sticky Header that Shrinks

↗
Sticky Header that ShrinksLayout & Scrolling

Back to Top Button

↗
Back to Top ButtonNavigation