Vitals 101
Vitals 101
@CoreVitals101

Reserve Space With aspect-ratio to Kill CLS

Sometimes you can't know an image's exact pixel size, especially with responsive layouts. The CSS aspect-ratio property still reserves the right shape so nothing jumps. CLS — Cumulative Layout Shift — drops when space is held in advance. Think of it as drawing a chalk outline before the furniture arrives.

Here's the playbook:
—
1. Find a container that loads content late — an image, video, or ad slot.
—
2. In your CSS, add aspect-ratio: 16 / 9; using the content's real shape.
—
3. For a square photo use 1 / 1; for a typical photo use 4 / 3.
—
4. Reload and watch the gap hold steady before content fills it.
—
5. Re-check CLS in your report.

This is perfect for embeds and ads where you can't set fixed pixels.

Try this: Add an aspect-ratio to one embedded video and watch the jump disappear.
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 за пакет по сети.