Fix guides · Performance
How to fix layout shifts (Cumulative Layout Shift, CLS)
Content that jumps as the page loads, so visitors tap the wrong thing. How to find what moves and stop it on Shopify, WordPress, Webflow, Wix, Squarespace and Next.js.
- Time to fix
- 30–90 minutes
- Skill needed
- Copy and paste
- Who notices
- Every visitor: text jumps while reading, taps land on the wrong button
Why it matters
Cumulative Layout Shift (CLS) measures how much visible content moves around unexpectedly. It's one of Google's Core Web Vitals; 0.1 or less is good.
Something shifts when space wasn't reserved for it: an image without a width and height, a banner or cookie notice that pushes content down, an ad or embed that loads late, or a web font that's a different size from the fallback shown first.
Animations that move elements by changing their size or position (rather than with transform) can also count as shifts and look jerky on phones.
“There is an increase from 60% of websites with good visual stability in 2020 to almost 80% in 2024.”
Before you start
- Your report names the elements that moved, and often the likely cause. Start with the biggest shift.
- Images: give every image a width and height (see our unsized images guide).
- Late content (banners, cookie notices, ads, embeds, "recently viewed" widgets): reserve its space in advance with a minimum height, or show it as an overlay that doesn't push the page down.
- Animations: animate transform and opacity, not top, left, width, height or margin.
Fix it on your platform
Shopify
- Shopify names the common causes as images without dimensions, fonts that swap in late, and content injected by apps.
- Use image_url with image_tag for theme images; it outputs width and height for you.
- For app blocks and announcement bars that appear after the page loads, give their container a min-height in your theme CSS, or move them below the first screen.
WordPress
- Check the shifting elements your report names. Sliders, cookie banners, ad plugins and lazy-loaded embeds are the usual causes.
- Set fixed heights for slider and ad areas in their settings, and make cookie banners overlay the page instead of pushing it down.
- If a font swap causes the shift, choose a fallback font of similar size or host the web font locally so it arrives sooner.
Webflow
- Avoid page-load interactions that change an element's size or position; use transforms and opacity, which don't move other content.
- Give embeds and CMS-driven sections a fixed or minimum height so they don't grow after loading.
- Upload fonts as WOFF2 custom fonts so they arrive sooner.
Wix
- Wix recommends placing ad elements, such as Google AdSense ads, below the fold rather than in a banner at the top.
- If your site uses a right-to-left language, check the DOM order in the Layers panel, as Wix advises.
- Avoid apps and widgets that insert content at the top of the page after it loads.
Squarespace
- Shifts usually come from custom code, embeds or extensions that add content after the page loads. Remove ones you don't need.
- Place embedded forms, widgets and videos lower on the page, away from the first screen.
Next.js
- next/image needs a width and height (or fill inside a sized container), so the space is reserved.
- next/font adds an adjusted fallback font by default, which keeps text the same size when the web font swaps in.
- Render banners and notices on the server, or reserve their space, instead of inserting them after hydration.
Any other site
- Add width and height to every <img>, <video> and <iframe>.
- Reserve space for content that loads later.
- Animate with transform instead of layout properties.
/* Reserve room for an ad or embed that loads later */
.ad-slot { min-height: 250px; }
/* Move without shifting other content */
.toast { transform: translateY(100%); transition: transform .3s; }
.toast.is-open { transform: translateY(0); }Check that it's fixed
- Re-run your StudioLNC audit: CLS should be 0.1 or less, and no shift culprits should be listed.
- In Chrome DevTools, the Performance panel's Layout shifts track shows exactly what moved.
- Real-visitor CLS in your Vitals Monitor follows over the next four weeks.
Find every issue like this on your site
Free audit of performance, accessibility, SEO and security, with fixes for your platform.