Building a Fluid Type Scale
You'll learn how to create a consistent, responsive typographic system that scales smoothly across all devices.
What Is a Fluid Type Scale?
A type scale is a set of harmonious font sizes for your headings and body text—like a musical scale for typography. A fluid type scale means these sizes grow and shrink smoothly between breakpoints using the clamp() function and viewport units you've already learned.
Instead of setting fixed sizes or jumping between values at media queries, you create a mathematical relationship where:
- Base font size (body text) scales fluidly
- Heading sizes maintain proportional relationships to the base
- Everything adjusts smoothly as the viewport changes
Building Your Scale
Think of a type scale as stacking blocks where each level is proportionally larger. A common ratio is 1.25 (major third) for moderate growth, or 1.5 (perfect fifth) for dramatic contrast.
Example fluid scale starting from body text:
:root {
/* Base body text: 16px at 320px, 18px at 1200px */
--step-0: clamp(1rem, 0.9091rem + 0.4545vw, 1.125rem);
/* Small text (step down) */
--step--1: clamp(0.8rem, 0.7273rem + 0.3636vw, 0.9rem);
/* H6/H5 */
--step-1: clamp(1.25rem, 1.1364rem + 0.5682vw, 1.4063rem);
/* H4 */
--step-2: clamp(1.5625rem, 1.4205rem + 0.7102vw, 1.7578rem);
/* H3 */
--step-3: clamp(1.9531rem, 1.7756rem + 0.8876vw, 2.1973rem);
/* H2 */
--step-4: clamp(2.4414rem, 2.2195rem + 1.1095vw, 2.7466rem);
/* H1 */
--step-5: clamp(3.0518rem, 2.7744rem + 1.3869vw, 3.4332rem);
}
body { font-size: var(--step-0); }
h6, h5 { font-size: var(--step-1); }
h4 { font-size: var(--step-2); }
h3 { font-size: var(--step-3); }
h2 { font-size: var(--step-4); }
h1 { font-size: var(--step-5); }
Each level maintains its proportional relationship while scaling smoothly with the viewport.
Key Takeaway: A fluid type scale uses clamp() and viewport units to create proportionally-related font sizes that scale harmoniously across all screen sizes, eliminating jarring typographic jumps.