Skip to content
Back to Concepts
CSS UniverseTrack 6: TypographyWeb Fonts & Variable Fonts
Typography · Track 6 CapstoneCore Concept 24

Web Fonts, @font-face & Variable Fonts

Eliminate web font performance penalties. Master @font-face loading, understand the difference between FOUT and FOIT with font-display: swap, and unlock infinite weights using modern Variable Fonts.

1. Mental Model: Static Font Files vs. The Variable Rubber Stamp

Legacy Static Fonts (12 Heavy Trucks)

In traditional web design, if your site used Roboto Regular, Medium, Bold, and Italic, the user's phone had to make 4 to 8 separate HTTP network requests downloading 300KB+ of static binary files.

• roboto-regular.woff2 (35KB)
• roboto-medium.woff2 (35KB)
• roboto-bold.woff2 (35KB)
• roboto-italic.woff2 (35KB)

Modern Variable Fonts (1 Single Morphing File)

A Variable Font stores vector math curves with adjustable control points along continuous axes. One single 45KB file can render weight 100, 432, 678, or 900 without downloading a single extra byte!

• inter-variable.woff2 (48KB)
• Supports infinite continuous weights 100 → 900
• Supports optical sizing, width, and slant axes

2. The Battle for Instant Pages: FOUT vs. FOIT & font-display

font-display: block (FOIT)

Flash of Invisible Text

The browser renders an empty blank box for up to 3 seconds while waiting for the web font. Users on slow mobile connections stare at a ghost page!

font-display: swap (FOUT - Recommended)

Flash of Unstyled Text

Browser immediately renders fallback system font (Arial/Roboto). Once the custom font arrives over the network, it swaps in seamlessly. Zero blank screens!

font-display: optional (Zero CLS)

Maximum Speed & No Jitter

Browser gives the font 100ms. If it's cached, it uses it; if not, it stays on the system font forever for this page view, caching it for next time. Zero layout shifts!

3. Interactive Studio: Variable Font Continuous Axes

Weight Axis ('wght')600
Width Axis ('wdth')100%
Slant Angle ('slnt')0°
@font-face & Variation CSS
font-variation-settings: 'wght' 600, 'wdth' 100;
font-display: swap;

Dynamic Variable Typography

Zero jumpiness. Smooth vector interpolation between razor-thin hairline and ultra-black bold.

First-Year Student Traps: Web Fonts

  • 1.Never use uncompressed .ttf or .otf files on the web! Raw TrueType (.ttf) files are often 500KB+ each. Modern browsers universally support .woff2 (Web Open Font Format 2), which uses Brotli compression to shrink files by over 70%!
  • 2.The Missing Preload Trap: Browsers do not download a web font until they parse the HTML, parse the CSS, and find an element in the DOM that actually uses the font! For your critical above-the-fold heading, add <link rel="preload" href="font.woff2" as="font" type="font/woff2" crossorigin> in your HTML head to start downloading immediately.
Next Masterclass · Track 7 Responsive

Responsive Design Principles & Fluid Layouts

Mobile-first mindset, fluid typography, touch targets, and embedded responsive testing studio.

Continue to Concept 25