Pick a scenario, watch the bad version shift, then see the fix side-by-side. Each demo shows exactly which code change stops the layout from jumping around.
When an <img> tag has no width and height, the browser
allocates zero space for it. The moment the image downloads, everything below it gets shoved down. This
is the #1 cause of CLS on the internet.
The fix: Always include width and height attributes. The browser uses them to calculate the aspect ratio and reserves the correct space before download.
<!-- Bad: zero space reserved -->
<img src="hero.webp" alt="Product">
<!-- Good: space reserved immediately -->
<img src="hero.webp" alt="Product"
width="800" height="450">
Set width and height on every <img> tag. Browser
reserves space automatically.
Use min-height on ad containers. A 300×250 ad needs a container with
min-height: 250px.
Use font-display: swap with size-adjust fallback to prevent text reflow.
Animate with transform and opacity — they don't trigger layout
recalculations.
YouTube embeds, maps, payment forms — all iframes need explicit width and
height.
Can't set dimensions? Use CSS aspect-ratio: 16/9 for responsive containers that hold
space.
VitalsFixer scans your page and shows exactly which elements are shifting and how to stop them. Free, instant, no signup.
Analyze My Site Free →Our engineers fix layout shift, image optimization, and all three Core Web Vitals. 48-hour turnaround. Full refund if your scores don't improve.
View Expert Fix Service →