How to Fix Cumulative Layout Shift (CLS) on Your Website: Causes and Solutions

How to Fix Cumulative Layout Shift (CLS) on Your Website: Causes and Solutions

by | Apr 6, 2026 | Uncategorized | 0 comments

What Is Cumulative Layout Shift and Why Does It Matter?

If you have ever been reading a webpage and the text suddenly jumped down, or you accidentally clicked the wrong button because something shifted on screen, you have experienced a layout shift. Cumulative Layout Shift (CLS) is a Core Web Vitals metric that measures visual stability. It quantifies how much unexpected movement occurs on a page as it loads.

Google uses CLS as a ranking signal. A poor CLS score can hurt your search visibility, increase bounce rates, and frustrate users. The good news is that most CLS problems are fixable once you know what causes them.

In this guide, we will walk through the most common causes of poor CLS scores and give you concrete, step-by-step fixes for each one. Whether you are a developer, a site owner, or someone managing a WordPress or Shopify store, this article will help you pass Core Web Vitals.

What Is a Good CLS Score?

Google classifies CLS scores into three categories:

Rating CLS Score What It Means
Good 0.1 or less Minimal unexpected shifts. Users have a stable experience.
Needs Improvement Between 0.1 and 0.25 Noticeable shifts. Action recommended.
Poor Above 0.25 Significant layout instability. Needs urgent attention.

Your goal should be to keep CLS at or below 0.1 for at least 75% of page loads.

How to Measure CLS on Your Website

Before you fix anything, you need to know where you stand. Here are the best tools to measure Cumulative Layout Shift:

  • Google PageSpeed Insights – Provides both lab data and field data (real user metrics) for any URL.
  • Google Search Console – The Core Web Vitals report highlights pages with CLS issues across your entire site.
  • Chrome DevTools – Open the Performance panel, enable “Web Vitals,” and record a page load to see exactly which elements shift.
  • Lighthouse – Built into Chrome, it audits your page and flags CLS contributors.
  • Web Vitals Chrome Extension – Shows real-time CLS, LCP, and INP scores as you browse.

Pro tip: Always test on both mobile and desktop. CLS issues often differ between the two because of different viewport sizes, responsive layouts, and ad placements.

The 10 Most Common Causes of Poor CLS (and How to Fix Each One)

Let us break down the most frequent culprits behind high CLS scores. For each cause, you will find a clear explanation and a practical fix.

1. Images Without Defined Dimensions

The problem: When an image tag does not include width and height attributes, the browser does not know how much space to reserve. Once the image loads, the surrounding content gets pushed down or sideways.

The fix:

  1. Always include width and height attributes on every <img> tag.
  2. Use CSS aspect-ratio for responsive images so the browser reserves the correct space even before the image loads.

Example:

<img src="hero.jpg" width="800" height="450" alt="Hero image" style="width:100%;height:auto;">

Alternatively, with modern CSS:

img {
  aspect-ratio: 16 / 9;
  width: 100%;
  height: auto;
}

This single fix resolves CLS issues on a large percentage of websites.

2. Web Fonts Causing FOUT or FOIT

The problem: When custom web fonts load slowly, the browser first renders text in a fallback font (Flash of Unstyled Text, or FOUT) or shows invisible text (Flash of Invisible Text, or FOIT). When the web font finally loads, text reflows and causes layout shifts.

The fix:

  1. Use font-display: swap in your @font-face declarations so the browser shows a fallback font immediately and swaps once the custom font loads.
  2. Preload critical fonts using the <link rel="preload"> tag in your document head.
  3. Choose a fallback font that closely matches the dimensions of your custom font to minimize reflow.
  4. Consider using the CSS size-adjust descriptor to fine-tune fallback font metrics.

Example preload tag:

<link rel="preload" href="/fonts/custom-font.woff2" as="font" type="font/woff2" crossorigin>

3. Dynamically Injected Content

The problem: Content that gets inserted into the page after the initial render, such as banners, newsletter popups, cookie consent bars, or promotional messages, pushes existing content around. Dynamically injected content near the top of the viewport causes the most severe layout shifts.

The fix:

  • Reserve space in advance. If you know a banner or element will appear, use CSS to allocate a fixed-height container for it before JavaScript loads the content.
  • Place late-loading content lower in the viewport where shifts are less impactful.
  • Use min-height on wrapper divs for any element that loads asynchronously.
  • For cookie consent banners, prefer overlays (positioned fixed or sticky) that do not push page content.

Example:

.promo-banner-wrapper {
  min-height: 80px;
}

4. Ads and Embeds Without Reserved Space

The problem: Third-party ads, video embeds, iframes, and social media widgets are notorious for causing CLS. They often load after the main content and push elements around unpredictably.

The fix:

  1. Wrap every ad slot or embed in a container with a defined min-height and min-width.
  2. Use the ad network’s recommended dimensions to pre-size containers.
  3. For iframes and video embeds, always specify width and height or use the aspect-ratio CSS property.
  4. Avoid placing ad slots above the fold if they load unpredictably.

5. Late-Loading CSS or Lazy-Loaded CSS Above the Fold

The problem: When critical CSS is deferred or lazy-loaded, the page initially renders without proper styles. Once the CSS arrives, elements resize and reposition, causing large layout shifts.

The fix:

  • Inline critical CSS directly in the <head> of your HTML so it is available immediately.
  • Do not lazy load CSS that affects above-the-fold content.
  • Use tools like Critical or Penthouse to extract and inline the CSS needed for initial rendering.

6. Elements That Resize After Loading

The problem: Tabs, accordions, carousels, or expandable sections that change size once JavaScript initializes can trigger layout shifts.

The fix:

  • Set explicit dimensions on these components using CSS before JavaScript enhances them.
  • Use the contain CSS property (contain: layout) on elements that might resize, to prevent their changes from affecting the rest of the page.
  • For carousels, define a fixed height or aspect ratio for the slide container.

7. Client-Side Rendering Without Skeleton Screens

The problem: Single-page applications (SPAs) and JavaScript-heavy pages often render content progressively. As components mount and data loads, the layout can shift multiple times.

The fix:

  1. Implement skeleton screens or placeholder UI that matches the dimensions of the final content.
  2. Use server-side rendering (SSR) or static site generation (SSG) where possible to deliver a stable initial layout.
  3. Avoid rendering a loading spinner that is then replaced by content of a different size.

8. Animations and Transitions That Trigger Layout

The problem: CSS animations that modify layout properties such as top, left, width, height, margin, or padding cause the browser to recalculate layout and can trigger CLS.

The fix:

  • Only animate transform and opacity. These properties are composited and do not trigger layout recalculations.
  • Replace top/left positioning animations with transform: translate().
  • Replace width/height animations with transform: scale() where possible.

Bad:

.box {
  transition: margin-top 0.3s;
}

Good:

.box {
  transition: transform 0.3s;
}

9. Late-Loading Navigation or Header Elements

The problem: If your header, navigation bar, or top banner depends on JavaScript to render, it may load after the rest of the page, pushing all content below it downward.

The fix:

  • Render header and navigation elements in the initial HTML rather than injecting them with JavaScript.
  • If a notification bar or announcement banner loads dynamically, reserve its height with CSS.
  • Use position: fixed or position: sticky for elements like cookie bars so they overlay the page instead of pushing content.

10. Responsive Design Breakpoints Causing Jumps

The problem: Media queries that drastically change element sizes or layouts at certain breakpoints can cause unexpected shifts during page load, especially when the viewport is near a breakpoint threshold.

The fix:

  • Test your layout at every major breakpoint during page load, not just after it is fully loaded.
  • Ensure that elements maintain consistent reserved space across breakpoints.
  • Use flexible sizing (percentages, viewport units, or clamp()) to create smoother transitions between breakpoints.

Quick Reference: CLS Fixes at a Glance

Cause Primary Fix Difficulty
Images without dimensions Add width/height or aspect-ratio Easy
Web fonts (FOUT/FOIT) Preload fonts, use font-display: swap Easy
Dynamically injected content Reserve space with min-height Medium
Ads and embeds Pre-size containers Medium
Lazy-loaded CSS above the fold Inline critical CSS Medium
Elements resizing after load Set explicit dimensions, use CSS contain Medium
Client-side rendering Skeleton screens, SSR/SSG Hard
Layout-triggering animations Animate only transform and opacity Easy
Late-loading headers/navs Render in initial HTML or reserve height Medium
Responsive breakpoint jumps Use flexible sizing, test at breakpoints Medium

How to Fix CLS in WordPress Specifically

WordPress sites are especially prone to CLS issues because of themes, plugins, and page builders that inject content dynamically. Here are WordPress-specific tips:

  1. Check your theme. Make sure your theme defines image dimensions and does not lazy load CSS for above-the-fold elements. Consider switching to a well-optimized theme if yours causes persistent issues.
  2. Audit your plugins. Plugins that add banners, popups, chat widgets, or ad scripts are common CLS offenders. Disable plugins one by one and re-test to identify the culprit.
  3. Use a performance plugin. Plugins like WP Rocket, Perfmatters, or FlyingPress can inline critical CSS, optimize font loading, and add missing image dimensions automatically.
  4. Exclude above-the-fold images from lazy loading. WordPress lazy loads images by default. For hero images and other above-the-fold visuals, add the fetchpriority="high" attribute and remove lazy loading.
  5. Specify dimensions for featured images in your theme. If your theme outputs featured images without width and height, edit the template or add a filter to include them.

How to Fix CLS on Shopify

Shopify stores often struggle with CLS because of app-injected scripts and dynamic product page elements. Key fixes include:

  • Set explicit dimensions on all product images and collection thumbnails.
  • Reserve space for app-injected elements like review widgets, upsell popups, and trust badges.
  • Avoid lazy loading CSS, especially for above-the-fold sections.
  • Optimize animations on product carousels and image sliders by using transform-based CSS.
  • Test with and without apps enabled to pinpoint which app causes the most CLS.

Step-by-Step Process to Debug CLS on Any Website

If you are not sure where to start, follow this workflow:

  1. Run PageSpeed Insights on the affected page and note the CLS score and flagged elements.
  2. Open Chrome DevTools, go to the Performance tab, check “Web Vitals,” and record a page load.
  3. Look at the Layout Shift entries in the timeline. Click on each one to see which element shifted and by how much.
  4. Identify the root cause using the categories above (missing dimensions, injected content, fonts, etc.).
  5. Apply the fix and re-test.
  6. Check Google Search Console after a few days to confirm that the Core Web Vitals report reflects your improvements.

Common Mistakes to Avoid When Fixing CLS

  • Hiding content with display: none to avoid shifts. This does not solve the problem. It just removes the content. Users and search engines still need it.
  • Fixing lab data but ignoring field data. Lab tools simulate a single device. Real users have different connections, devices, and behaviors. Always verify with field data from the Chrome User Experience Report (CrUX) or Search Console.
  • Over-optimizing by deferring too much. Aggressively deferring scripts or lazy loading everything can actually cause more CLS if it delays rendering of visible elements.
  • Ignoring mobile. Most CLS issues are worse on mobile. Always test both viewports.

Frequently Asked Questions About Cumulative Layout Shift

What is a good Cumulative Layout Shift score?

A CLS score of 0.1 or lower is considered good by Google. Scores between 0.1 and 0.25 need improvement, and anything above 0.25 is rated as poor.

How do I fix CLS issues quickly?

The fastest wins come from adding width and height attributes to all images, preloading web fonts, and reserving space for dynamically loaded content like ads and banners. These three fixes alone solve the majority of CLS problems.

Does CLS affect SEO?

Yes. Cumulative Layout Shift is part of Google’s Core Web Vitals, which are used as a ranking signal. A poor CLS score can negatively impact your search rankings, especially in competitive niches where other factors are equal.

How do I fix Cumulative Layout Shift in WordPress?

Start by adding image dimensions, optimizing font loading with a plugin like WP Rocket or Perfmatters, and auditing plugins that inject content above the fold. Also make sure your theme does not lazy load critical CSS.

What is the difference between CLS and other Core Web Vitals?

CLS measures visual stability (how much the layout shifts). Largest Contentful Paint (LCP) measures loading performance (how fast the main content appears). Interaction to Next Paint (INP) measures responsiveness (how quickly the page reacts to user input). All three must pass for a page to have good Core Web Vitals.

Can JavaScript cause CLS?

Absolutely. JavaScript that injects or modifies DOM elements after the initial page render is one of the most common causes of layout shifts. The solution is to either render content server-side or reserve space for JavaScript-injected elements.

How long does it take for CLS improvements to show in Search Console?

Google collects field data over a rolling 28-day window. After deploying fixes, expect to wait at least 28 days before you see full improvements reflected in the Core Web Vitals report in Search Console.

Final Thoughts

Fixing Cumulative Layout Shift is one of the most impactful things you can do for both user experience and SEO. Most CLS issues boil down to a few recurring causes: missing image dimensions, uncontrolled font loading, and dynamically injected content without reserved space.

The good news is that these problems are predictable and fixable. Start with the quick wins, measure your progress with real user data, and work through the more complex issues systematically.

If you need help diagnosing and fixing CLS issues on your website, get in touch with our team at j-a-b.net. We specialize in web performance optimization and can help you pass Core Web Vitals with confidence.