Performance: Font family utilities
MEDIUM IMPACT
This affects page load speed and rendering performance by controlling which font files are downloaded and how text is painted.
<div class="font-sans">Text</div><div class="font-serif font-mono font-sans">Text</div>| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Multiple font-family utilities on same element | No extra DOM nodes | Multiple reflows due to font swaps | High paint cost due to font decoding | [X] Bad |
| Single font-family utility per element | No extra DOM nodes | Single reflow | Low paint cost | [OK] Good |
| Custom font without font-display | No extra DOM nodes | Reflow blocked until font loads | High paint cost, blocks LCP | [X] Bad |
| Custom font with font-display: swap | No extra DOM nodes | Reflow occurs after fallback paint | Lower paint cost, faster LCP | [OK] Good |