You know CLS — Cumulative Layout Shift — loves jumping images. The classic fix is width and height attributes, but for responsive images that scale with the screen, there's a cleaner tool.
Think of it like telling the browser the shape of the box, even when you don't know the exact size yet. It reserves the right proportions, so nothing jumps when the image arrives.
1. In CSS, add aspect-ratio: 16 / 9 to your image (match your real ratio).
2. Set width: 100% and height: auto so it scales cleanly.
3. The browser now reserves correctly-shaped space upfront.
This pairs perfectly with width/height attributes — belt and suspenders.
This one's easier than it sounds, just two CSS lines.
Try this: apply it to one gallery image, reload on slow network, and watch the jump disappear.
Vitals 101
@CoreVitals101
aspect-ratio: the modern fix for image CLS
This post was published in the Telegram channel Vitals 101 (@CoreVitals101). All its posts are on the channel page.
Open on Telegram