How to Find and Fix Layout Shift (CLS) Using Chrome DevTools: A Practical Guide
Have you ever started reading a page, and the text suddenly jumped down because an image or ad loaded above it? That jump is a layout shift , and Google measures it with a Core Web Vital called Cumulative Layout Shift (CLS) . A good CLS score is 0.1 or less . Anything above 0.25 is considered poor, and it can hurt both user experience and your rankings. In this guide I will show you how I find…
Cumulative Layout Shift (CLS) is a Core Web Vital metric that measures how much content on a web page shifts around as it loads. Google considers a CLS score of 0.1 or less to be good, while anything above 0.25 is poor and can negatively impact user experience and search rankings. There are five main causes of layout shift: images and videos without defined dimensions, late-loading ads and embeds, fonts that swap and change text size, content injected with JavaScript above existing content, and animations that alter position attributes instead of using transform.
To measure CLS, run a page through PageSpeed Insights or Lighthouse in Chrome DevTools, noting both field data (real user data) and lab data (test data). To find elements causing shifts, enable Layout Shift Regions in DevTools and reload the page. Each moving element will flash blue. For more detail, use the Performance panel to record a page load and inspect the Layout Shifts track.
To log shifts, paste a small PerformanceObserver script into the Console, which will log the shift score and the DOM node that moved. To fix layout shift issues, ensure all images and videos have explicit width and height attributes, reserve sufficient space for ads, embeds, and iframes, preload fonts with appropriate fallback options, avoid inserting content above existing content (especially in cases like cookie bars and banners), and animate elements using transform and opacity rather than position. Following these steps can significantly reduce layout shift problems on your web pages.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.