Tutorials

How to Fix Cumulative Layout Shift (CLS): A Practical Checklist

A step-by-step checklist to find and fix the elements that make your pages jump, with copy-paste code for images, embeds, and fonts.

1 min read

Layout shift is the most fixable Core Web Vital. The causes are well understood, the fixes are mostly a few lines of HTML or CSS, and the improvement is immediately visible to visitors. Work through this checklist in order.

1. Find what is shifting

Before changing anything, find the culprits. In Chrome DevTools, open the Performance panel, record a page load, and look for the Layout Shifts track. Each red marker points to the element that moved.

2. Give every image dimensions

Images without width and height attributes take up zero space until they load, then push everything below them down. Adding the attributes lets the browser reserve the right space from the start, even for responsive images.

index.html
<img src="/hero.webp" width="1200" height="630" alt="Product dashboard" style="width:100%;height:auto">

3. Reserve space for embeds and ads

Videos, maps, social embeds, and ad slots often load last and push content around. Wrap them in a container with a fixed aspect ratio or minimum height so the space exists before the content does.

styles.css
.embed {
  aspect-ratio: 16 / 9;
  width: 100%;
}

.ad-slot {
  min-height: 250px;
}

4. Stop web fonts from reflowing text

When a custom font replaces the fallback font, differences in letter width can reflow entire paragraphs. Preload your main font file and use a size-adjusted fallback so the swap is nearly invisible.

styles.css
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial");
  size-adjust: 107%;
}

body {
  font-family: "Inter", "Inter Fallback", sans-serif;
}

5. Never insert content above existing content

Cookie banners, promo bars, and late-loading notices that push the page down are a major source of shifts. Overlay them instead, or reserve their space in the initial HTML.

Target

Aim for a CLS of 0.1 or less at the 75th percentile of your visitors. That is the threshold Google uses to mark a page as good.

LightLoader handles steps two through four automatically by measuring media and reserving space before it loads. If you would rather fix things by hand, this checklist covers the vast majority of real-world layout shift.

SEO

Does Page Speed Actually Affect Google Rankings? What the Evidence Says

An honest look at how much page speed and Core Web Vitals influence Google rankings, where speed is only a tiebreaker, and where it pays off anyway.

  • Rankings
3 min read
Guides

Why Your PageSpeed Score Changes Every Time You Test (and Which Number Matters)

Run PageSpeed Insights twice and get two different scores? Here is why that happens, how the score is calculated, and the numbers Google actually uses.

  • Lighthouse
  • Core Web Vitals
3 min read
Start optimizing in minutes

Ready to supercharge your website?

Join thousands of websites already using LightLoader to deliver lightning-fast experiences to their users.

No credit card required. Free plan available.

  • Quick Setup

    Install in under 5 minutes

  • Works Everywhere

    Compatible with any platform

  • Instant Results

    See improvements immediately