Visual design · Step 4 · 7 min read
Alignment and vertical rhythm
Vertical rhythm — the regular spacing of text baselines on the Y axis — makes pages easier to scan and helps different type sizes feel like they belong together. How cap-height, line-height and baseline snap work, and when to override them.
A grid organises columns. Vertical rhythm organises lines of text on the Y axis.
What you'll be able to do after reading:
- Explain what vertical rhythm means and why it matters
- Describe the three parts of the rhythm model: cap-height, line-height, baseline snap
- Apply baseline-aligned spacing in a component
- Decide when to override rhythm for a practical spacing reason
1. Why rhythm matters on the Y axis
A column grid aligns things horizontally. But a screen has two axes. On the Y axis, text lines either fall at regular intervals or they don't. When they do, the reader's eye follows the content down the page without hesitation. When they don't, the eye has to recalibrate at each line — a small effort that is invisible in isolation, but cumulative over a long page.
This regularity is called vertical rhythm: a consistent spacing unit on the Y axis that all type sizes and components relate to. It is the typographic equivalent of the spacing scale. In print, Robert Bringhurst defines this as "the basic unit of vertical space in a text" in The Elements of Typographic Style (4th ed., Hartley & Marks, 2012). In a UI, the same idea applies: when text at different sizes shares a common baseline grid, the page feels coherent even when the content is varied.
2. The three-part model
The model in this lesson has three parts:
Cap-height is the height of a capital letter in a given typeface at a given size. It is what the eye reads as the "top" of a line of text — not the full ascender height, which includes the full height of characters like "h" and "l," and not the em square, which is the invisible box the font is drawn in. Cap-height is the visible height that affects how close two lines look to each other.
Line-height is the total vertical space allocated to a line of text, including the space above and below the glyphs. In CSS it is set as a unitless multiplier (e.g., line-height: 1.5 means the line height is 1.5× the font size). Gale uses: 1.2 for headings, 1.5 for body text, 1.33 for labels and table cells. These values come from Gale.md and are fixed for the fictional product.
Baseline snap is the technique of aligning text to a regular grid of horizontal lines — the baseline grid — so that text at different sizes shares common reference points. In practice, this means adding top padding to a text element so its first baseline falls on a grid line, and setting margins and padding in multiples of the base unit so subsequent baselines continue to land on the grid.
Work order WO-2026-018734
Gearbox oil change — CA-07-T14, Site Portugal. Scheduled for 09 Dec 2026, crew 07-B.
PLANNED · 3 steps remaining
Diagram: Marcus Andrey, CC BY 4.0.
3. How the three parts connect
The relationship between cap-height and line-height determines how close lines feel. A short cap-height with generous line-height produces open, airy text. A tall cap-height with tight line-height produces dense, information-heavy text. Gale Console's label line-height (1.33) reflects that choice: technicians and planners read many rows, and a tighter line-height packs more data into the same screen height without feeling crowded.
Baseline snap turns these decisions into a system. When the base unit of the spacing scale is 4px, a baseline grid of 4px (or a multiple like 8px) means every line of text, every component and every gap can share a common reference. A 16px label at 1.33 line-height produces a computed line of 21.28px. Rounding to the nearest 4px grid line (20px or 24px) and adjusting the top padding keeps the baselines aligned.
This is design work, not auto-generated by a tool. The designer chooses the base unit, sets the line-height, and manually checks that baselines snap. Figma's baseline grid overlay, Storybook's visual regression tests and browser DevTools' grid inspector can all help check alignment once the values are set.
4. When to override rhythm
Rhythm is a guide, not a law. Three situations justify overriding it:
Component boundaries. A card's internal padding uses the spacing scale (16px, 24px), not the baseline grid. The text inside the card is baseline-aligned; the card's outer spacing is not.
Images and media. An image height is dictated by its aspect ratio. It will rarely land on a baseline. Set the spacing above and below the image using the spacing scale and move on.
Very small text. At 11–12px (table cells at Compact level), the computed line-height may fall between grid lines. In this case, align the row height to the nearest grid value and treat the internal baseline alignment as "best effort."
The rhythm is established. The next step is responsive layout: how the grid folds in smaller viewports and containers.
5. Common mistakes
- Confusing line-height with leading. In CSS,
line-height: 1.5applies to the full line box. In print typography, "leading" is the space between the baseline of one line and the baseline of the next. They produce the same visual result but are measured differently. When reading a print spec, convert leading to line-height: line-height = leading / font-size. - Applying the same line-height to all text. Headings at 1.5 look loose; body at 1.2 looks suffocating. Gale uses three values: 1.2 for headings, 1.5 for body, 1.33 for labels. Use the right value for each context.
- Baseline-snapping every element. Only snap text. Components, images and decorative elements follow the spacing scale, not the baseline grid. Trying to snap everything creates rigid layouts that break on any variation in content.
- Skipping the check. Rhythm is invisible when it works. The only way to know it is working is to overlay a grid and inspect. Build the check into your review process.
6. Try it
You need: a screenshot of a page with multiple text sizes (a news site, a dashboard header, or any screen from Grids for dense screens and marketing pages).
- Identify at least two different text sizes on the screen (a heading and body text, for example).
- Draw (or trace) a horizontal line at the baseline of the first line of the larger text.
- Count down: does the baseline of the smaller text below it fall on a regular interval from that line, or does it land at an arbitrary position?
- Estimate the base unit: what multiple of 4px best describes the vertical interval between baselines?
- Find one place where the rhythm breaks (a component, an image, a button that sits between two text lines). Write one sentence about why that element disrupts the rhythm.
How to know it's good: you can describe the page's baseline interval as a multiple of 4px, and you can name one element that breaks the rhythm and why.
7. If you already practise
- In Figma, the baseline grid overlay (Layout > Baseline grid) lets you check text alignment visually. Set the offset equal to your cap-height value so the grid starts at the first visible text line, not at the top of the em square.
- Some teams implement baseline snap as a utility class that adds the correct top padding automatically. This requires knowing the cap-height of the typeface as a fraction of the em square — which the typeface documentation (or a tool like Capsize) can provide.
- Baseline grid alignment is more important in long-form reading contexts (editorial, documentation) than in dense data products where rows replace baseline rhythm. In a table, the row height is the rhythm unit.
Checklist
Learn more
- MDN, line-height
- Seek OSS, Capsize — cap-height calculator
- Matthias Ott, CSS Baseline: The Good Parts (Piccalilli, 2024)
Books, courses and videos to go deeper
- The Elements of Typographic StyleRobert BringhurstBook · 4th ed., Hartley & Marks, 2012
- Web TypographyRichard RutterBook · Five Simple Steps, 2017
Related
Type scale, line height and measure · Grids for dense screens and marketing pages · Spacing scales · Responsive layout with CSS grid and container queries