Vitals 101
Vitals 101
@CoreVitals101

Stop Web Fonts From Shifting Your Text

When a custom font loads, text can suddenly swap from a backup font to the real one, nudging everything around — a flash of restyled text. That movement feeds CLS — Cumulative Layout Shift. Think of it like swapping out a tablecloth while dinner is on the table.

The playbook:
—
1. Find where your font loads in CSS, the @font-face rule.
—
2. Add font-display: swap; inside it so text shows immediately.
—
3. To stop the jump, pick a backup font with similar width in your font stack.
—
4. Preload your main font file with a preload link in the head.
—
5. Reload and watch for any text reflow.

Matching the backup font's size to the real one minimizes the shift.

Try this: Add font-display swap to your heading font and reload twice to spot the change.
This post was published in the Telegram channel Vitals 101 (@CoreVitals101). All its posts are on the channel page.
Open on Telegram

Latest posts in “Tools and infrastructure”

All channels in this category →

реклама в сети

Готовы запустить рекламу через сеть public.tg?

Новый оффер, продукт, GEO, кейс, событие или партнёрский запуск — соберём маршрут под задачу и отдадим медиаплан.

Telegram для медиаплана: @AFFtop_connect. Быстрый тест: $20 за канал, $1000 за пакет по сети.