Why does my page jump around while it loads?
CLS — Cumulative Layout Shift — measures how much of a page’s visible content moves unexpectedly while it loads. A good score is 0.1 or under. The usual cause is content arriving without reserved space: images with no width and height, ads or embeds that push everything down, and web fonts that swap in late. Give every element its space up front, and the page stops jumping.
Why it matters
A shifting page isn’t just ugly — it makes people tap the wrong thing. The button you were about to press slides down a centimetre and you hit the ad, the link, or the delete button instead. On a shop that means a lost sale; on a form it means starting over; everywhere it means a page that feels broken, even if it loaded fast.
Google measures CLS as one of the three Core Web Vitals, alongside LCP and INP, and it feeds into the page-experience signals. A page can load quickly and still fail Core Web Vitals on CLS alone — speed and stability are scored separately, and visitors notice the shifting long before they notice a slow paint.
The buy button that moved
A shop’s product page loads fast, but the “Add to cart” button sits below a promo banner that arrives a second late. A shopper goes to tap the button just as the banner pops in — the button jumps down, and their tap lands on a “Remove from wishlist” link instead. One annoyed shopper, one lost sale, and a layout shift Google measured the whole time.
The fix isn’t a faster banner; it’s a reserved space. The banner’s slot is given a fixed height in the page before anything loads, so when the banner arrives it fills a gap that was already there. Nothing below it moves, the button stays where the shopper’s thumb expected it, and the CLS score drops to near zero.
<!-- reserve the space before the image loads -->
<img src="hero.jpg" width="1200" height="800" alt="..." />
<!-- or hold a fixed-height slot for a late ad or banner -->
<div style="min-height: 250px"> ... ad loads here ... </div>
How do you stop the shifting?
Start with images and video: always give them a width and height (or an aspect-ratio in CSS) so the browser reserves exactly the right space before the file arrives. Then do the same for anything that loads late — ads, embeds, social widgets — by holding a fixed-height slot for them. If the content is shorter than the slot, the empty space is a far smaller sin than a jump.
Fonts are the other quiet culprit: when a web font swaps in late, every line of text reflows and the whole page shudders. Use font-display: swap so text shows immediately, and preload the one or two fonts that matter. And never inject content above what’s already on screen after load — a cookie banner or promo bar that drops in from the top pushes everything down, which is exactly the shift CLS counts.
How to check it
- Run the page in PageSpeed Insights — a CLS under 0.1 is good, over 0.25 needs fixing
- Open the ‘Avoid large layout shifts’ diagnostics to see exactly which elements moved, and by how much
- Give every image and video a width and height (or aspect-ratio) so the browser reserves the space first
- Reserve a fixed-height slot for ads, embeds and banners — never let them push content down after load
- Test on a slow connection (throttled 4G in DevTools) — shifts hide on fast wifi and show up on real phones
Lazy-loading images without dimensions. The image arrives late, the browser had reserved no space for it, and the whole page jumps down when it finally appears. Lazy loading only helps CLS when the space is reserved first.