
Type Scale and Modular Systems for Product UI
One base, one ratio, roughly six to eight steps, and one clamp() expression — plus line-height tokens and an audit path for the scale that has already drifted.
TL;DR: A defensible type scale is one base size, one ratio, roughly six to eight steps, and one fluid expression — not a list of font sizes a designer picked one by one over time. Pair the scale with line-height and letter-spacing as part of each token, lock the base at the browser default of 16 CSS pixels, and replace breakpoint duplication with a single clamp() expression anchored to viewport or container units. This guide walks the ratio choice, the fluid scaling pattern, and the audit path for a scale that has already drifted.
Product UIs without a type scale tend to collect font sizes the way old phones collected chargers — slowly, accidentally, and with no plan for which one matches what. The fix is not picking better individual sizes; it is replacing the whole list with a system small enough that designers remember it and disciplined enough that engineers can lint against it. A type scale is a low-cost legibility intervention in a mature design system, and one that keeps paying back.
This article is part of the web UX patterns guide. It covers the working detail of the typography section in the main guide.
Why arbitrary font sizes break long-term
A design system that ships without an explicit type scale tends to drift. Designers add 14px for one card subtitle, 15px for a second card subtitle two sprints later, 13px for a tooltip, and 17px for a headline that needed to be "a bit bigger than the body." Over time, an audit can find far more distinct font-size declarations across the codebase than anyone intended.
Three things go wrong as a consequence. Visual rhythm collapses, because paragraphs and headings stop relating to each other through a shared interval. Design tokens lose explanatory power — --size-md-alt-2 is a name with no meaning. And the cost of any global typographic change — denser tables, larger body text, a brand refresh — becomes a search-and-replace exercise rather than a token update.
The intervention is small. One base value, one ratio, a clear set of steps, and a discipline that any new size has to come from the scale or get rejected at review.
Modular scale: pick a ratio, pick a base
A modular scale is a base value multiplied or divided by a fixed ratio. The ratio is the only design decision; the rest follows.
Common ratios, most of them named after musical intervals, map to product-UI density like this:
| Ratio | Name | Best for |
|---|---|---|
| 1.125 | Major second | Very dense dashboards, data tables |
| 1.2 | Minor third | Product UI, admin panels |
| 1.25 | Major third | Standard product UI |
| 1.333 | Perfect fourth | Editorial-leaning product UI |
| 1.5 | Perfect fifth | Long-form editorial, marketing pages |
| 1.618 | Golden ratio | Display-heavy editorial, brand sites |
For product UI, a ratio between 1.2 and 1.25 is a reasonable starting point. The interval is small enough to keep dense screens readable but large enough that headings clearly outrank body. Marketing and editorial work can go to 1.333 or 1.5, where the larger jumps give display headlines room to breathe.
Start the base at 16 CSS pixels. That is the browser default, and overriding html { font-size: 14px; } to make everything proportionally smaller breaks the accessibility contract — users who increase their browser default for legibility expect that increase to scale your UI. Set the base at 16 and use the scale to step both up (subhead, head, display) and down (small, caption, micro).
A practical implementation in CSS custom properties looks like this:
:root {
/* Base = 16px, ratio = 1.25 (major third) */
--step--2: 0.64rem; /* 10.24px - micro */
--step--1: 0.8rem; /* 12.8px - caption */
--step-0: 1rem; /* 16px - body */
--step-1: 1.25rem; /* 20px - lead / h4 */
--step-2: 1.5625rem; /* 25px - h3 */
--step-3: 1.953rem; /* 31.25px - h2 */
--step-4: 2.441rem; /* 39.06px - h1 */
--step-5: 3.052rem; /* 48.83px - display */
}As a rule of thumb, six to eight steps is a workable range. Fewer than six and you can run out of hierarchy; more than eight and designers can lose track of which step is which.
Fluid type with clamp() vs step changes at breakpoints
The breakpoint ladder for typography — different font sizes at 768, 1024, 1280 — is a habit from before clamp() became Baseline Newly available in July 2020, when responsive type meant repeating the same declaration inside several media queries. The alternative is one fluid expression that interpolates between a minimum and maximum value.
The clamp(min, preferred, max) function takes three values. The first is the floor and the third is the ceiling (if the floor is larger than the ceiling, the floor wins), and the middle expresses a target that usually involves viewport units so the value rises with screen width.
:root {
--step-4: clamp(1.75rem, 1.5rem + 1.5vw, 2.441rem);
/* Floor 28px, scales with viewport, ceiling 39px */
}Two things to watch. The floor must stay readable — 16 CSS pixels is a sensible floor for body text. WCAG sets no minimum font size, but 16 CSS pixels is the browser default, and a floor written in rem keeps following the user's own font-size setting, as long as the root font-size is not fixed in pixels. That setting is one of the user-agent text scaling mechanisms listed in the W3C Understanding document for WCAG 1.4.4 Resize Text, alongside full-page zoom, magnification, and text-only resizing; the document accepts scaling text up to 200% with any one of them. The ceiling has to be ergonomic — as a rule of thumb, a body size that drifts past about 22 CSS pixels on very wide screens starts looking like an ebook, not a product UI. Display sizes can go higher, into 64 or 96 CSS pixels; there, line length is the more useful check on the ceiling.
The preferred value benefits from a small constant offset. A pure 1.5vw expression ignores the user's text-size setting and may not grow when the user zooms; 0.5rem + 1vw keeps a rem term in the preferred value, so the value still responds to the user's font-size preference while the viewport unit handles the climb. Tools like Utopia's fluid type scale calculator and the calculator introduced in Adrian Bece's fluid typography article on Smashing Magazine generate the math for you. The MDN reference on clamp() covers the edge cases.
For component-scoped fluid type — a card title that scales with its container, not the viewport — anchor the preferred value to container query units (cqi, cqw) instead of viewport units. That requires an ancestor, such as the card, to declare container-type: inline-size (or size). The units resolve against the nearest such ancestor, and without one they fall back to the small viewport size. Declaring a container is part of the container queries pattern covered in the responsive UI development topic.
Line-height, letter-spacing, and rhythm
Font size by itself is half the type scale. Line-height and letter-spacing are the other half, and they need to travel with the size as part of the same token.
Line-height is best expressed as a unitless ratio, not a fixed pixel value. A unitless 1.5 scales correctly when font-size changes; a fixed 24px does not. Starting ratios to try for product UI:
- Body text: 1.5 to 1.6 — generous reading rhythm
- Lead paragraphs: 1.4 to 1.5 — slight tightening
- Subheads (h3, h4): 1.3 to 1.4
- Headings (h1, h2): 1.2 to 1.3
- Display: 1.0 to 1.2 — tight, because the eye is reading shapes, not lines
Smaller type can need proportionally more line-height. A 12 CSS-pixel caption at 1.3 can look cramped; the same caption at 1.5 reads more cleanly.
Letter-spacing follows an inverse pattern. Display type can benefit from slight negative tracking — letter-spacing: -0.02em to -0.04em — because letters at 48 CSS pixels can look like they have too much air between them at the default spacing. Body text wants neutral spacing. One case for generous positive tracking is ALL-CAPS labels, where a letter-spacing: 0.05em keeps the letters from running into each other.
Pack all three into one token group:
/* One token group, applied together */
.type-h2 {
font-size: var(--step-3);
line-height: 1.25;
letter-spacing: -0.01em;
}CSS has no syntax for bundling several properties into one custom property — designers express the group as one text style in Figma, and engineers ship it as three properties applied together via a utility class like the one above or a CSS-in-JS abstraction. The point is that a designer who says "use h2" gets all three values, not just the size.
Pairing scale with semantic tokens
Designers and engineers should reference tokens by what they mean, not by what step number they are. caption, body, lead, h3, h2, h1, display are names that survive a brand refresh; --step-3 is not.
A typical product-UI token map ends up looking like:
| Token | Step | Use |
|---|---|---|
| caption | step--1 (12.8px) | Helper text, timestamps, badges |
| body | step-0 (16px) | Paragraphs, form inputs |
| lead | step-1 (20px) | Section intros, large body |
| h4 | step-1 (20px) | Card titles, list group labels |
| h3 | step-2 (25px) | Subsection headings |
| h2 | step-3 (31px) | Section headings |
| h1 | step-4 (39px) | Page titles |
| display | step-5 (49px) | Marketing or hero headings |
Some steps are reused — lead and h4 can point to the same step but carry different line-height tokens. As a rule of thumb, eight to ten semantic tokens is a practical ceiling. Beyond that, designers can stop memorizing the system and start picking steps by trial and error.
The same group should hold size, line-height, letter-spacing, and font-weight. If your design system uses a tool like Every Layout's layout components, the type-scale tokens slot in naturally as one input to layout-aware components rather than as a parallel list.
Auditing an existing scale
When you inherit a UI with thirty font-size values across the codebase, the audit path is not "rewrite everything." It is incremental.
The first pass is inventory. Search for every font-size declaration in CSS, every fontSize in JavaScript, every typography style in Figma. Sort by frequency. As a rule of thumb, a value that appears in more than fifty places is doing real work; one that appears in two is probably a one-off.
The second pass is mapping. Take each value and map it to the closest step in your target scale. Many will map cleanly — 15px, 16px, and 17px all become body, and 19px becomes lead; an 18px sits halfway between body and lead and needs a call. Some will not — 13px and 13.5px floating around can indicate an under-considered caption variant. Flag those.
The third pass is replacement, spread across three releases rather than one massive pull request. Replace one token group per release — body and caption first, headings second, display last. Lint rules can enforce the lock once the migration is complete; tools like Stylelint ship rules that disallow raw values for selected properties.
The fourth pass is governance. Any new font-size added after the migration has to go through design-system review and either land in the scale or extend it intentionally. Without that gate, the same drift starts again.
A scale audit is a bounded piece of work whose size depends on how many codebases and design files carry typography. Skipping it is what makes the next design refresh feel like rebuilding instead of refining.
Diagnostic checklist for the next planning cycle
- Count unique
font-sizevalues in your CSS — if you find more than 12 (a rule of thumb, not a standard), the scale has drifted. - Pick a base and ratio. 16 CSS pixels, ratio 1.2 or 1.25 for product UI.
- Generate 6–8 steps and name them semantically (caption, body, lead, h4, h3, h2, h1, display).
- Convert each step from breakpoint declarations to one
clamp()expression. - Attach line-height and letter-spacing to each step as part of the same token group.
- Lock the scale via a lint rule that disallows raw
font-sizevalues outside the token list.
The scale is one decision that pays back every screen the product ever ships.