Skip to content
Home » Egyptian SEO Blog » what is Cumulative Layout Shift (CLS) in core web vitals ?

what is Cumulative Layout Shift (CLS) in core web vitals ?

Cumulative Layout Shift (CLS) is a Core Web Vital that measures the visual stability of a webpage. It quantifies unexpected layout shifts that occur throughout the page lifecycle and evaluates their impact on the user experience. CLS measures both the size of the affected area and the distance elements move within the viewport.

Why Is CLS Important?

Unexpected layout shifts can disrupt the user experience and lead to frustration. Users may lose their place while reading content, click the wrong button, or interact with unintended elements when page content moves unexpectedly. CLS helps developers identify and reduce these visual disruptions to create a more stable and user-friendly experience.

How Is CLS Scored?

CLS is a unitless score that starts at zero and increases as unexpected layout shifts occur.

  • Good: ≤ 0.1
  • Needs Improvement: > 0.1 and ≤ 0.25
  • Poor: > 0.25

Google evaluates CLS using real-user data collected through the Chrome User Experience Report (CrUX). To achieve a Good CLS rating, the 75th percentile of page visits over a rolling 28-day period must record a CLS score of 0.1 or lower.

Common Causes of CLS and How to Fix Them

Unexpected layout shifts typically occur when browsers render page elements at different sizes or load content after the initial layout has already been displayed.

Images and Videos Without Dimensions

When developers do not specify dimensions or aspect ratios, browsers cannot accurately reserve space for media before it loads. As a result, surrounding content may shift when the image or video appears.

Fix: Always define explicit width and height attributes or use CSS aspect ratios to reserve the correct amount of space before media loads.

Ads, Embeds, and Iframes

Advertisements, embedded content, and iframes often load after the main page content, which can cause sections of the layout to resize unexpectedly.

Fix: Reserve sufficient space for ads, embeds, and iframes before they load, and avoid inserting them above existing content whenever possible.

Web Font Loading Issues

Custom fonts can change text dimensions when they replace fallback fonts, causing text containers to resize and shift nearby content.

Fix: Preload critical fonts, use font-display: swap, and choose fallback fonts with similar metrics to minimize layout changes during font loading.

Dynamically Injected Content

Banners, cookie notices, promotional messages, and other dynamically inserted elements can push existing content downward when they appear unexpectedly.

Fix: Reserve space for dynamic content before it loads or insert it in a way that does not alter the existing page layout.

Important Note

CLS only measures unexpected layout shifts. Layout shifts that occur shortly after a qualifying user interaction, such as opening a menu, expanding an accordion, or clicking a button, are generally excluded from CLS calculations because users expect those changes to occur.

Seo detective

Leave a Reply

Your email address will not be published. Required fields are marked *