Layout bug · Fix guide

Page Jumps While Loading? How to Fix Layout Shift (CLS)

Updated October 22, 2026

Layout shift is when visible content moves after it first appears, usually because an image, ad, embed, font or banner loads without reserved space. Google measures it as Cumulative Layout Shift (CLS); a good score is 0.1 or less. Reserve space with width and height attributes or aspect-ratio, and avoid inserting content above what is already visible.

Quick diagnosis

  • Text moves down as images appear: images are missing width and height.
  • A bar slides in at the top after load: an announcement, cookie or app banner is injected above content.
  • Text changes size after a moment: a web font swaps in with different metrics.
  • Buttons move just as you tap: a late-loading embed, ad or review widget pushes them.

Causes and fixes

1

Images without width and height

Most common

The browser does not know how tall an image will be until it downloads, so it renders the text first and then pushes it down.

Fix: Add width and height attributes to every <img> (CSS can still make them responsive), or set aspect-ratio on the container.

2

Banners and bars injected at the top

Announcement bars, cookie banners and app-injected promos that appear after load push the whole page down.

Fix: Reserve the space in the initial HTML, or show banners as overlays fixed to the bottom that do not move content.

3

Embeds, ads and widgets with no reserved space

Review stars, social embeds, maps and ad slots load late and expand from zero height.

Fix: Give the container a min-height close to the final size of the widget.

4

Web fonts swapping in

With font-display: swap, the fallback font shows first. If the web font is wider or taller, lines rewrap and the page shifts.

Fix: Preload the main font file and use size-adjust on a fallback @font-face so both fonts take the same space.

5

Animations that change layout properties

Animating height, top or margin moves surrounding content on every frame.

Fix: Animate transform and opacity instead, which do not trigger layout shift.

How to find it on your site

  1. 1

    Measure CLS

    Run the page through PageSpeed Insights. The field data shows real-visitor CLS; the lab report lists the largest layout shifts.

  2. 2

    Highlight shifts live

    In Chrome DevTools open the Rendering panel (Ctrl+Shift+P, type "Rendering") and tick "Layout Shift Regions". Moving areas flash blue as the page loads.

  3. 3

    Throttle the connection

    Set the Network panel to Slow 4G. Shifts that are invisible on fast Wi-Fi become obvious.

  4. 4

    Fix the biggest shift first

    The Performance panel lists each shift with the elements that moved. Reserve space for the element that caused the largest one, then re-measure.

Fixes by platform

Shopify

Apps that inject announcement bars, review stars or upsell blocks are the most common source. Modern themes add image dimensions automatically, but images placed in rich-text or custom Liquid often lack them.

WordPress

WordPress adds width and height to images inserted through the editor, but sliders, page builders and ad plugins often do not. Lazy-load plugins that replace images with zero-height placeholders also cause shifts.

Wix and Squarespace

Third-party code embeds and announcement bars are the usual cause. Keep embeds in fixed-size blocks and test with a slow connection.

Custom code

Use your framework's image component (it sets dimensions), set aspect-ratio on media containers, and track CLS from real visitors with the web-vitals library.

Frequently asked questions

What causes layout shift on a website?

Content that loads without reserved space: images without width and height, ads and embeds that expand after load, banners inserted above existing content, and web fonts that swap in at a different size.

What is a good CLS score?

Google treats a Cumulative Layout Shift of 0.1 or less as good, 0.1 to 0.25 as needing improvement, and above 0.25 as poor, measured at the 75th percentile of real page loads.

How do I stop my page from jumping when it loads?

Add width and height attributes to images, reserve space for embeds and ads with min-height, show banners as overlays instead of inserting them above content, and preload fonts with matched fallback sizes.

Does layout shift affect SEO?

CLS is one of Google's Core Web Vitals, which are part of its page experience signals. The bigger cost is usually conversions: shifts make visitors tap the wrong link or button.