Vitals 101
Vitals 101
@CoreVitals101

Reserve Space With aspect-ratio to Kill CLS

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.
Этот пост опубликован в Telegram-канале Vitals 101. Подписаться можно по ссылке: @CoreVitals101.
tech

Свежие посты в категории «Tech Infrastructure»

Все каналы категории →

start

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

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

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