Guide

font-display explained: swap, optional, fallback and block

What each font-display value does, how web fonts cause layout shift, and how a tuned fallback font keeps your page steady while fonts load.

Quick answer: use font-display: swap for most text so it shows right away in a fallback font, and add a fallback with matching metrics to avoid layout shift. Use optional if you would rather skip the font than risk a visible swap.

What font-display does

It tells the browser what to show while a web font is still downloading.

The @font-face generator adds the value you pick.

The layout shift problem

When a swap happens, the new font usually has different letter widths and line heights, so text reflows and content jumps. That counts against Cumulative Layout Shift.

Fix it with a tuned fallback

Define a local fallback font and adjust it with size-adjust, ascent-override, descent-override and line-gap-override until it matches the web font's metrics. Then the swap barely moves anything. The fallback font matcher calculates the numbers for you.

Other quick wins

Which value should you pick?

Body text: swap with a matched fallback. Decorative fonts that the page can live without: optional. Icon fonts: block, since a fallback letter in place of an icon looks broken.