How to Fix Cumulative Layout Shift (CLS): Resolving the 6 Primary Causes

Why Layout Shifts Destroy User Experience

We have all experienced it: you begin reading an article or reach to click a navigation link, and suddenly the entire page jumps downward. You end up clicking the wrong button or losing your reading position entirely.

Google quantifies this frustration through Cumulative Layout Shift (CLS). A poor CLS score signals an unstable, poorly engineered frontend and actively harms your search rankings. Here is how to diagnose and resolve the six most common causes of layout shift.

1. Images Without Explicit Dimensions

The single most common cause of CLS is un-dimensioned images. When the browser downloads the HTML, it does not know the image's height until the binary image file arrives, causing existing content to jump when the image renders.

The Fix: Always specify explicit width and height attributes on every <img> tag, or set aspect-ratio in CSS:

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

2. Dynamic Ad Slots and Embeds

Ad banners and third-party widgets that inject content into the DOM after page load push surrounding content downward.

The Fix: Always wrap dynamic ad or embed containers in a placeholder wrapper with a reserved min-height matching the expected creative size.

3. Web Fonts and Flash of Invisible Text (FOIT/FOUT)

When a web font finishes downloading, replacing the system fallback font with a custom font with different metrics causes lines of text to re-wrap.

The Fix: Match fallback font metrics using CSS @font-face descriptors: size-adjust, ascent-override, and descent-override.

4. Late-Injected Cookie Banners & Promotional Bars

Never dynamically insert top announcement bars or cookie banners into the document flow above existing content after page load. Instead, position banners using position: fixed or allocate reserved space on initial server render.

Achieve Stable, Green Performance

Eliminating layout shifts requires systematic frontend hygiene. Test your current pages with our free speed check tool or hire me for a targeted performance audit.