Skip to content
Back to Concepts
CSS UniverseTrack 6: TypographyTypography & Layout
Typography · Track 6Core Concept 23

Typography, Vertical Rhythm & Readability

95% of web design is typography. Master why you must always use unitless line-height, the 65-character rule for human eye comfort, and modern CSS text-wrap: balance.

1. The Gutenberg Mental Model: The 65-Character Line Length Rule

When humans read a line of text, our eyes travel horizontally from left to right. At the end of the line, our brain performs a "carriage return" to locate the beginning of the next line.

Line Too Long (> 85 characters)

If text stretches all the way across a 27-inch 4K monitor, your eyes lose their place when jumping back to the next line. Readers constantly reread the same line twice, causing extreme eye fatigue!

The Golden Ratio (45 - 75 characters)

Set max-width: 65ch; on your prose articles. The ch unit matches the exact width of the character "0", guaranteeing effortless reading rhythm!

2. The Most Important Rule in CSS Typography: Always Use Unitless line-height!

❌ NEVER DO THIS: line-height: 1.5em;
body {
font-size: 16px;
line-height: 1.5em; /* Computes to 24px! */
}
h1 {
font-size: 48px;
/* Inherits fixed 24px! Letters collide and overlap! */
}

When you use a unit like em, the parent computes a static pixel value once (16 × 1.5 = 24px). The child heading inherits the static 24px height, causing 48px letters to crash into each other!

✅ ALWAYS DO THIS: line-height: 1.5;
body {
font-size: 16px;
line-height: 1.5; /* Unitless multiplier! */
}
h1 {
font-size: 48px;
/* Computes 48px × 1.5 = 72px! Perfect spacing! */
}

A unitless number is inherited as a pure mathematical multiplier. Every child element multiplies its own font-size by 1.5!

3. Interactive Studio: Live Readability & text-wrap: balance

Font Size18px
Line Height (Unitless Multiplier)1.60
Letter Spacing (Tracking)0px
CSS Typography Rules
font-size: 18px;
line-height: 1.6;
letter-spacing: 0px;
text-align: left;
text-wrap: balance;

The Future of Modern Web Interface Typography

Good typography makes words feel natural and frictionless. When line-height is proportional to font size and line length is capped at sixty-five characters, users can read thousands of words without experiencing cognitive exhaustion.

text-wrap: balance automatically calculates line breaks so all headline lines have roughly equal width!

4. Deep Visualizer: Variable Font Axes & Rhythm

Typesetting & Rhythm

Typography & Typographic Rhythm Lab

Fine-tune font metrics, line-height vertical rhythm, letter-spacing tracking, and modern text-wrap balancing.

Try these

  • Toggle "text-wrap: balance" to watch CSS automatically equalize line lengths and eliminate lonely orphan words.
  • Switch on "Show Baseline Grid" to observe how line-height aligns text with the vertical rhythm grid.
  • Adjust letter-spacing when text-transform is uppercase: loose tracking improves all-caps readability dramatically.
  • Test different font weights (100-900) to see variable font interpolation in real-time.
26px (1.625rem) · line-box: 40px · wght: 600text-wrap: balance

Modern CSS typography gives designers precise mathematical control over vertical rhythm, optical kerning, and variable font interpolation axes.

Computed: 26px / 40.3px line box+0.02em tracking

/* Typographic Rhythm & Readability System */ .typeset-headline { font-family: system-ui, -apple-system, sans-serif; font-size: 26px; /* 1.625rem */ line-height: 1.55; letter-spacing: 0.02em; font-weight: 600; font-variation-settings: "wght" 600; text-transform: none; text-wrap: balance; /* Modern CSS: avoids orphan words on last line */ hyphens: auto; } /* Vertical Rhythm: Computed line box height = 40px */

First-Year Student Traps: Typography

  • 1.The Mobile Long Word Overflow Trap: Long URLs or words like Supercalifragilisticexpialidocious will burst through card borders on mobile viewports. Always add overflow-wrap: break-word; to prevent horizontal page scrolling!
  • 2.The text-align: justify River Trap: While newspaper print engines hyphenate carefully, browsers doing text-align: justify stretch whitespace unevenly, creating distracting white "rivers" flowing through paragraphs. Stick with text-align: left or combine with hyphens: auto.
Next Masterclass

Web Fonts, @font-face & Variable Fonts

Eliminate FOUT/FOIT with font-display: swap, preload critical woff2 assets, and master multi-axis variable fonts.

Continue to Concept 24