Engineering Guides

Production @font-face CSS: Preload, crossorigin, and font-display Strategy

Write bulletproof @font-face CSS with font-display: swap vs optional, crossorigin preload hints, and metric-matched fallbacks for fast LCP.

4 min readUpdated:

Quick Answer

For fast production web fonts, serve WOFF2 exclusively with font-display: swap (paired with size-adjust fallback metrics) or optional, preload only the 1–2 primary above-the-fold weights using <link rel="preload" as="font" type="font/woff2" crossorigin>, and remove legacy EOT, TTF, and SVG URLs to prevent redundant browser downloads.

Choosing between font-display: swap, fallback, and optional

Leaving font-display unset triggers FOIT (Flash of Invisible Text) for up to 3 seconds in most browsers, hurting First Contentful Paint. Choosing font-display: swap shows text immediately with the fallback font and upgrades once WOFF2 lands; choosing optional gives the font a ~100 ms swap window and otherwise sticks to fallback until the next navigation, ensuring zero late shifts.

ValueBlock PeriodSwap PeriodBest Use Case
swap~0–100 msInfiniteBrand headings & body paired with CLS overrides
optional~100 msNoneStrict zero-CLS body copy on variable networks
fallback~100 ms~3 secondsBalanced fallback on flaky connections

The crossorigin preload rule everyone forgets

Because font requests are always fetched in anonymous CORS mode per the CSS Fonts spec, a <link rel="preload" as="font"> tag missing crossorigin initiates a non-CORS fetch that cannot match @font-face—causing browsers to download the font twice!

Always include crossorigin even when the .woff2 sits on your own domain, and restrict preloads strictly to the 1–2 weights rendered above the fold.

<link
  rel="preload"
  href="/fonts/inter-regular.woff2"
  as="font"
  type="font/woff2"
  crossorigin
/>

Pairing @font-face with Anti-CLS overrides

FontTo inspects your font's actual weight class, italic flag, variable axes, and OS/2 vs hhea metrics to emit copy-paste @font-face CSS, preload HTML, and Anti-CLS fallback rules together.

Frequently asked questions

How many fonts should I preload on a page?

Preload at most 1–2 above-the-fold weights (e.g. Regular 400 and Bold 700). Preloading 6+ fonts competes with hero images and critical CSS.

Should I include local() in @font-face src?

Generally avoid local() for web fonts because user-installed versions of fonts like Inter or Roboto may be outdated or lack localized glyphs.

Do I still need WOFF, TTF, and EOT lines inside src:?

No. Modern browsers since 2016–2018 support WOFF2, so keeping only format('woff2') keeps CSS lean and maintainable.

Authoritative References

Tools used in this guide

Related formats

Related Comparisons

More engineering guides