SiteTidy
HomeGuidesCore Web Vitals (Part 4): Eliminate CLS Without Freezing Your Layout
Performance

Core Web Vitals (Part 4): Eliminate CLS Without Freezing Your Layout

Fix Cumulative Layout Shift by reserving image, ad and async-content space, controlling font swaps, handling banners and animations correctly, and debugging real layout-shift sources.

Published on August 15, 2026Updated August 31, 2026
Core Web Vitals (Part 4): Eliminate CLS Without Freezing Your Layout

Few web-performance problems annoy users as directly as layout shift.

You aim for “Buy now” and an advert appears above it. The button moves. You click something else.

You start reading a paragraph and a late-loading image pushes the text halfway down the screen.

A cookie banner inserts itself into normal document flow and the entire page jumps.

Cumulative Layout Shift (CLS) exists to measure that kind of unexpected visual instability.

A good CLS is 0.1 or less at the 75th percentile. More than 0.1 up to 0.25 needs improvement; above 0.25 is poor.

The good news is that CLS is often one of the most deterministic Core Web Vitals to improve. Most fixes come back to a simple design principle:

If content is going to occupy space later, decide what happens to that space before it arrives.

CLS is not “the page moved”

Pages are allowed to change.

Open an accordion and the content below it moves. Click “load more” and additional cards appear. Expand a validation message after submitting a form.

Movement that follows a user’s action can be expected.

CLS is primarily interested in unexpected shifts that occur without the user reasonably causing them.

This distinction matters because trying to create a page that literally never changes size would make many useful interfaces impossible.

The goal is stability, not rigidity.

How layout-shift scoring works conceptually

A layout shift is influenced by two ideas:

  • how much of the viewport was affected;
  • how far the unstable elements moved.

The browser groups shifts into session windows and CLS reports the largest relevant burst rather than naively summing every movement over an arbitrarily long page lifetime.

You do not need to calculate this manually to fix a site. But understanding the model explains why a large hero/header jump is much more damaging than a tiny badge moving a few pixels.

Images without dimensions: the classic CLS bug

Consider:

<img src="/product.jpg" alt="Blue running shoe">

Before the image loads, the browser may not know its aspect ratio. The surrounding content is laid out, then the image arrives and space must be created.

Give the browser dimensions:

<img
  src="/product.jpg"
  width="1200"
  height="800"
  alt="Blue running shoe"
>

Responsive CSS still works:

img {
  max-width: 100%;
  height: auto;
}

The width/height attributes establish the intrinsic aspect ratio so the browser can reserve proportional space before the file finishes loading.

This is one of those rare optimisations that is simple, robust and worth doing almost everywhere.

Use aspect-ratio for components whose media is not known in markup

Sometimes a component does not have useful intrinsic dimensions available at render time.

You can still reserve its shape:

.video-placeholder {
  aspect-ratio: 16 / 9;
  width: 100%;
}

This works well for:

  • video players;
  • embedded media;
  • card thumbnails;
  • maps;
  • application previews;
  • skeleton containers.

Do not reserve a random ratio just to make Lighthouse green. Match the eventual content closely enough that replacement does not create another shift.

Ads are a layout-design problem, not just an ad-tech problem

Ad slots are notorious CLS sources because the final creative size may not be known immediately.

If the page initially allocates zero height and later inserts a 250-pixel advert, everything below it moves.

Reserve a slot based on the expected size:

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

Responsive ad systems are trickier because different breakpoints may return different formats. Design a predictable slot strategy per viewport class.

You have choices:

  • reserve the largest likely size;
  • reserve a breakpoint-specific size;
  • collapse empty slots only when doing so will not cause disruptive movement;
  • place uncertain dynamic inventory lower in the page.

There is no CSS incantation that makes a 300-pixel late insertion occupy zero space.

Skeletons only work when they resemble the final layout

A skeleton loader can improve perceived performance and stability — or make CLS worse.

Bad skeleton:

[ tiny 80px placeholder ]

Final component:

[ 420px product configurator ]

The placeholder existed, but it did not reserve meaningful space.

Build skeletons from the geometry of the final component:

  • similar height;
  • same major columns;
  • similar media ratio;
  • stable header/footer regions.

The user should experience content replacing a reserved shell, not the page rebuilding itself.

A consent banner inserted at the top of the document after JavaScript starts can push the entire page down.

Two common designs avoid surprise:

Overlay

.consent-banner {
  position: fixed;
  inset-inline: 1rem;
  bottom: 1rem;
}

The banner overlays the page rather than reflowing it.

You still need to consider accessibility and whether it obscures important controls.

Reserved layout

If the banner must live in document flow, the server/initial HTML can reserve its space when consent state is known.

What you want to avoid is discovering 1.5 seconds after paint that the top of the page suddenly needs another 120 pixels.

Injecting content above existing content is inherently risky

Notifications, promotional bars, install prompts and personalisation blocks often arrive asynchronously.

Inserting them above content the user is already viewing creates movement.

Prefer one of these patterns:

  • reserve the slot from the start;
  • overlay non-essential UI;
  • insert new asynchronous content below the current content;
  • wait for an explicit user action before expanding the layout.

If your CMS can optionally produce a campaign banner, the template should know a banner slot exists even if campaign data arrives later.

Web fonts can shift text dramatically

A fallback font and your final web font can have different glyph widths, x-heights and line metrics.

The fallback renders, then the web font arrives. A heading that occupied two lines becomes three. Everything below it moves.

Possible mitigations include:

  • choose a metrically similar fallback;
  • subset fonts so critical files arrive sooner;
  • preload only genuinely critical font files;
  • use appropriate font-display behaviour;
  • use font metric overrides where suitable (size-adjust, ascent/descent/line-gap overrides);
  • avoid loading a zoo of weights before useful content can stabilise.

Font optimisation is not merely about reducing KB. Matching layout geometry matters.

Dynamic form errors need reserved or intentional behaviour

Imagine a form:

Email [________________]
Password [_____________]
[Sign in]

After submit, a two-line email validation error appears between the fields and pushes everything downward.

That movement follows user input, so its CLS treatment may differ from unsolicited movement, but the UX can still feel sloppy.

Options include:

  • reserve a predictable validation-message area;
  • place summary errors in a stable region;
  • animate deliberate expansion appropriately;
  • ensure focus management remains accessible.

Do not optimise the metric while making the form worse. Stability is a UX objective first.

Animations: prefer transforms over layout-changing properties

Animating properties such as top, left, width or height can trigger layout work and move surrounding content.

For purely visual motion, transforms are often a better fit:

.toast {
  transform: translateY(1rem);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

A transform changes how the element is painted without necessarily recalculating the layout of neighbouring content.

But do not convert meaningful document-flow changes into overlays purely to manipulate CLS. Choose the correct interaction design.

Carousels can be surprisingly unstable

A carousel whose slides have different heights can resize every time the slide changes.

Fix the container geometry:

.carousel-media {
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.carousel-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

For text-heavy slides, either design for a stable content region or accept deliberate user-triggered resizing rather than allowing automatic rotations to throw the page around.

Auto-rotating content also has accessibility implications beyond CLS.

Lazy loading does not require layout shift

Lazy-loaded images are not inherently unstable.

This is fine:

<img
  src="/below-fold.jpg"
  loading="lazy"
  width="1200"
  height="800"
  alt="Example report"
>

The browser reserves the aspect ratio even though the resource is fetched later.

The problem is lazy loading into unreserved space, not lazy loading itself.

Client-side rendering: make the shell representative

A common SPA pattern renders a tiny loading spinner, fetches data and then replaces it with a large dashboard.

[spinner]

becomes:

[header]
[chart       chart]
[large table     ]

That is a structural transformation.

Render a meaningful shell instead:

[header placeholder]
[chart shell  chart shell]
[table skeleton         ]

Better still, render stable content server-side where the architecture permits it.

Sticky headers can create shifts when implemented carelessly

A header that changes from 100 px to 64 px when scrolling may pull the document upward if its layout footprint changes.

You can often keep a stable outer container and transform/style the inner content instead.

Likewise, inserting an announcement bar above a sticky header after page load is a reliable way to move the whole viewport.

Debug CLS visually

Chrome DevTools can identify layout shifts and help reveal the elements that moved.

Use that instead of clicking around the page hoping to notice every jump.

In field monitoring, collect layout-shift attribution where your tooling supports it. A CLS value without the affected nodes is much harder to turn into engineering work.

Also remember that shifts can happen later in a visit:

  • when an ad refreshes;
  • when a carousel rotates;
  • when a delayed widget initialises;
  • when an SPA changes content;
  • when infinite scroll inserts items;
  • when a font variant is requested only after interaction.

A five-second synthetic test can miss those.

A practical CLS investigation

Step 1: segment by route/template

Find where real-user CLS is actually poor.

Step 2: capture shift attribution

Identify the unstable elements and what moved them.

Step 3: reproduce with cache disabled and constrained network

Late assets are easier to expose when they are not already cached.

Step 4: inspect asynchronous insertions

Ads, consent, personalisation and third-party widgets deserve special attention.

Step 5: check media dimensions and font behaviour

These are common, systematic fixes.

Step 6: test later page states

Scroll, wait for ad refreshes, open UI and navigate within long-lived apps.

Step 7: verify in RUM

A layout that looks stable on your laptop may behave differently with another language, viewport, font state or content variant.

Find the structural problems first

SiteTidy can help surface page, image and delivery issues; pair that audit with browser layout-shift tooling and RUM attribution to find the elements that actually move for users.

Run Free Audit →

Common CLS mistakes

Adding fixed heights everywhere

Hard-coded heights can create overflow, clipping and localisation problems. Reserve appropriate geometry, often with aspect ratios, min-heights or representative shells.

Blaming all movement on images

Ads, fonts, banners, hydration and async components can dominate CLS.

Removing useful UI because it moves

A user-triggered accordion is not the same thing as an unsolicited ad insertion.

Testing only the initial load

Long-lived pages can shift much later.

Using skeletons with the wrong dimensions

A skeleton is useful only if it stabilises the eventual component.

Ignoring responsive variants

A desktop layout may reserve the right ad slot while mobile uses a completely different creative size.

Production checklist

  • set width/height on content images;
  • use aspect-ratio where intrinsic dimensions are unavailable;
  • reserve predictable ad/embed/media slots;
  • make skeletons resemble final component geometry;
  • avoid inserting unsolicited content above existing content;
  • design consent/promo banners to overlay or reserve space intentionally;
  • minimise font-metric changes during swaps;
  • prefer transform/opacity for purely visual animations;
  • keep carousel/container geometry stable;
  • render representative shells for async application content;
  • capture layout-shift attribution in RUM;
  • test delayed and interactive page states, not just first load;
  • verify across languages, content lengths and breakpoints.

The best CLS fixes rarely feel like hacks. They usually make the interface architecture more deliberate: the browser knows where things belong before those things finish arriving.

Part 5 goes deeper into images and media — not only for LCP and CLS, but for bandwidth, responsive delivery and avoiding a page full of expensive assets the user never sees.

Ready to audit your site?

Put this guide into practice immediately using our free tools.

Browse 180+ Free Tools