Skip to content
IndexRequest a UIAboutContact

Vertical Rhythm & Baseline Grid

Text snapped to an 8px baseline grid versus text with arbitrary spacing, with the grid overlay switchable.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI IMAGE OR VIDEO TOOL
Editorial layout mockup of a single text column on a warm white page with a faint horizontal baseline grid every 8 pixels drawn in pale blue, a bold heading and two short paragraphs whose every line sits exactly on the grid lines, equal gaps between blocks, small labels showing line-height 24px and gap 16px in the margin, flat design, no images. Negative: lines between grid lines, uneven gaps, decorative fonts, shadows, text errors. Reduced motion: static layout.

About this pattern

Definition

Vertical rhythm means every line height and gap is a multiple of one base unit. Lines then fall on a regular invisible grid, which makes columns and blocks line up and makes the page feel calm even when you cannot say why.

When to use it

  • Choose a unit (4 or 8px) and make line heights and margins multiples of it.
  • Round the line height up to the next multiple: a 15px font with a 1.5 ratio becomes 24px on an 8px grid.
  • The off-grid version drifts a little every paragraph, which is visible when two columns sit side by side.

What the controls do

  • Snap on or off, unit 4 or 8px, and a Show grid toggle.

Motion & timing

  • Changes apply instantly; no animation.
  • Reduced motion: nothing to change.

Tips & variations

  • Use rem or a CSS variable for the unit so it scales with user font size.
  • Images and cards should also have heights in multiples of the unit.

Code of this live preview

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Spacing"><button data-p="0" aria-pressed="true">Snapped to grid</button><button data-p="1" aria-pressed="false">Off the grid</button></div><div class="row2"><div class="pre" id="un" role="group" aria-label="Unit"><button data-u="4" aria-pressed="false">4px</button><button data-u="8" aria-pressed="true">8px</button></div><label class="sw"><input id="gd" type="checkbox" checked> Show grid</label></div><div class="tx" id="tx"><h4>Quiet rhythm</h4><p>Lines that share a grid look calm.</p><p>Gaps use the same unit, so blocks line up.</p></div><p class="out" id="out" aria-live="polite"></p></div>

Related patterns

Modular Grid, Gutters & Margins

↗
Modular Grid, Gutters & MarginsLayout Structures

Composition Grids

↗
Composition GridsLayout Structures

Modular Type Scale

↗
Modular Type ScaleType Styles