How to Fix Cumulative Layout Shift (CLS) Issue in WordPress & Shopify?

fix CLS issue

Cumulative Layout Shift (CLS) measures how much your website’s pages move around unexpectedly. Or, It tells you how stable your site feels for visitors.

Even though many things affect user experience, a poor CLS score not only frustrates users but also harms your SEO. Google cares about CLS, so you should too; otherwise, you will lose your chances of ranking on search results.

This is why understanding what is CLS issue​ and how to solve CLS issues is super necessary for improving your site’s performance.

And this guide is just right for that. Here we will also address the biggest reasons why your page shifts and the top ways to stop this. So, won’t it be a smart move to fix them on the spot and not let your visitors struggle with your unstable site?

If you agree, then let’s start with understanding CLS thoroughly.

What is Cumulative Layout Shift Meaning?

Cumulative Layout Shift (CLS) measures how stable your webpage looks while loading. It calculates the total amount of unexpected movements on your page. A layout shift happens when something changes its position or size, pushing other content around.

Search engines want you to have a good CLS score (less than 0.1) because it directly affects user experience. If your website jumps around too much, visitors will struggle to use it. And guess what, Google never wants its users to suffer like that.

CLS is one of the important metrics (Core Web Vitals) that negatively affect your rankings if it is too high.

But a fully static page, (which is the best case) has a score as low as zero.

Now let’s learn how will you find out if you are in a good space or bad.

How to Measure Your CLS Score?

You know what, a high score means your page has too many unexpected shifts. This directly shows your website as an unreliable one. If visitors feel this way, they won’t even trust you so forget about them making a purchase. And that’s too bad for your business.

So, only with proper optimization your site will look smooth, feel stable, and rank higher.

CLS Standards

Good Below 0.1 This is where you want to be
Average 0.1-0.25 You should make changes now
Poor Above 0.25 This can seriously hurt your ranking

If your grade is average or poor then you need instant help. And as I told you earlier, we will provide you with that.

But first, go through these two popular methods to perform a Cumulative Layout Shift test:

  • Lab testing (helps you find and fix problems in a controlled environment)
  • Field testing (tells you how real users experience your website)
Tool Name Lab Data Field Data 
Lighthouse ✅ Yes ❌ No
PageSpeed Insights ✅ Yes ✅ Yes
Chrome DevTools ✅ Yes ❌ No
Chrome User Experience Report 

(CrUX)

❌ No ✅ Yes
Search Console 

(Core Web Vitals Report)

❌ No ✅ Yes
WebPageTest ✅ Yes ❌ No
GTmetrix ✅ Yes ❌ No

However, don’t just rely on one instead go for both lab and field tests to fully understand your website’s CLS.

Now that you know your scores, let’s understand what is causing it and how to fix CLS issue in WordPress or Shopify.

Common Cumulative Layout Shift Causes and Ways to Solve Them

You might not know but you may have different CLS scores for different pages and screens. Plus, layout shifts on mobile screens have an even bigger impact on mobile users. As more than 60% of all online searches are now carried out on a mobile device, you must optimize your website for a smoother experience.

Now, let’s get back to the point, see the below factors that cause CLS issues:

  • Images, Buttons, and Links Without Set Dimensions
  • Ads, Banners, or Embeds Without Reserved Space
  • Slow-Loading Web Fonts (FOUT & FOIT)
  • Messy Animations & Transitions

Yes, these elements are causing you trouble, but do not worry. The blog is not completed yet, here is the information on how to solve CLS issue:

1. Define Width And Height In CSS or Html

Your browser does not know how much space images, buttons, links, iframes, and videos will need, so it lets the page load first and then adjusts it when the content finally appears. Thus, everything seems to jump around as not having set dimensions.

To fix this CLS issue, you need to:

  • Set fixed height and width for all images, videos, iframes, and other elements in your CSS or HTML.
  • Plus, add a placeholder, if you’re using lazy-loaded images with the exact same dimension of the image.

So, instead of letting your site face bad SEO rankings, take control and define sizes in advance. This simple step on how to improve CLS score goes beyond just making your page look stable.

2. Allocate Space Beforehand for Dynamic Content

Instead of keeping room for Ads, Banners, Embeds, or third-party scripts, the browser loads the visible content first. Then, when these missing elements arrive, they force everything to move and cause Cumulative Layout Shift (CLS) problems.

Here no one is guilty, it is just that you haven’t reserved space for dynamic content.

But no worries, here is how to fix CLS issue now:

  • Set a fixed height and width for ads, embeds, chatbots, social media feeds, etc. using CSS (min-height, min-width).
  • Place a blank container (placeholder) so nothing moves when it appears.
  • Avoid injecting content above existing elements or always load them below or inside pre-allocated spaces.
  • To display ads, you have to choose the ad size range wisely based on past data.

By doing this, you indirectly tell the browser how much space these elements will take and prevent unnecessary moving of the entire page.

3. Apply Font-Display: Swap and Preload Key Fonts

The third tip on how to fix the Cumulative Layout Shift (CLS) issue is related to web fonts. Don’t we all love web fonts because they are beautiful and make our website stand out? But, it does have some drawbacks like, layout shifts as they take a long time to load in.

These custom fonts are not in your local system so your browser needs time to download them. While the web font is downloading, the page usually renderers with a fallback font (inbuilt system fonts) which may differ in size from the final font.

This is where CLS occurs, but you can prevent it through:

  • Telling the browser to show a fallback font immediately while loading the custom one. Once the custom font is ready, it swaps in seamlessly without causing delays.
  • Add <link rel=”preload”> in your HTML to load essential fonts early, so they’re available before content appears.
  • You should self-host fonts instead of relying on external sources like Google Fonts. Also, use modern .woff2 files instead of outdated .woff and .ttf for better performance.
  • Use only necessary font weights and styles to keep file sizes small and Pick a system font that closely matches your custom font.

4. Use CSS Transform and Opacity Instead of Animations

Where Animations make your website feel alive, but can also mess up your layout if not done in the right way.

Do you know, that when we animate properties like width, height, margin, or position, our page constantly reflows and adjusts? Yeah, but it can cause layout shifts; if not done in the right way.

You can solve this type of Cumulative Layout Shift issue by:

  • Use transform: scale() to resize elements smoothly without affecting the layout.
  • Apply opacity to fade elements in or out without shifting content.
  • Replace direct position changes with transform: translateX() or translateY() instead of modifying top, left, or margin.
  • You should prefer CSS transitions more over animations, as they create smoother effects and yet reduce layout shifts.
  • Try avoiding animating width, height, box-shadow, or box-sizing, as much as possible and stick to transform properties like translate, scale, rotate, or skew to prevent re-layout issues.

Moreover, regularly check how you are performing against your competitors and what you can do to improve your CLS score and bad user experience.

Still, Need Help on How to Fix CLS Issue?

In this post, we shared tips for solving the Cumulative Layout Shift issue. We are happy that Core Web Vitals has brought attention to this annoying problem, which many web developers have overlooked for too long. With the above techniques, you can identify and even improve it.

However, if you fail to eliminate CLS completely, still your efforts will reduce its impact. You can even give a chance to an automated Core Web Vitals optimization plugin, and watch your CLS score go down to 0. With this, you will save a lot of your time, plus, it will instantly speed up your site too.

W3Speedster is an all-in-one solution to optimize CLS without any technical hassle so, try it now and experience the difference.

Leave a Reply