Skip to content
RU
← All articles

CLS: eight layout shift causes and how to find them

In short:

CLS rises when visible elements move without an expected user action. In Chrome DevTools, record Performance → Layout shifts, inspect the largest cluster and reserve space for content that arrives late. Our local fixture scored 0.0399 without a reserved image slot and zero with one.

Engineer checking stable page layout on a workstation
Reserved image space keeps text in place.

A layout jump can move a button away from a finger or make a reader lose a line. The page can still have good TTFB. This guide lists eight common causes, a DevTools workflow and a reproducible local test. Delayed click response is a separate problem covered by the INP diagnostic guide.

What CLS measures

A layout shift occurs when a visible element changes its starting position between frames. An event score combines the affected viewport area and movement distance. Page CLS uses the worst session window, not a plain sum of every movement across the whole visit. A good threshold is at most 0.1 at the 75th percentile of user visits. Movements soon after expected user input can be excluded, so a hands-off test may differ from an interactive session.

Do not hide the page until everything loads merely to improve the score. That may worsen perceived speed and LCP. Keep content geometry predictable before images, ads or API data arrive. Compare the field and laboratory view when judging the result.

Eight causes to inspect

CauseTrace symptomFix
1. Unsized imageText moves after the image loadsSet width and height or aspect-ratio
2. Video or iframe without spacePlayer appears after HTMLReserve a ratio-aware container
3. Ad or third-party embedShift follows an external responseReserve a slot matching expected size
4. Banner above contentWhole page moves after JavaScriptReserve space or use a usable overlay
5. Late font swapLine wrapping changes after WOFF2 loadsMatch fallback metrics and font-display
6. Margin or top animationRepeated shifts during motionUse transform for decorative motion
7. API response inserts contentCards jump after fetchUse a same-size skeleton or stable container
8. Hydration changes dimensionsServer HTML and client DOM differAlign initial server and client states

Several causes may combine in one session window. A font can change a heading height while a banner appears below it. Start with the largest cluster. Fixing many tiny events first may barely change the final score.

Engineer comparing mobile page layout with a timing trace
The Layout shifts track points to the moment of movement.

Find the shift source in Performance

Open the page in Chrome, start a reload recording in DevTools → Performance, and look for purple diamonds on the Layout shifts track. Select the largest cluster. The details pane shows timing, score and moved elements. A highlighted element is the victim of movement; the cause may sit above it in the DOM. Inspect network responses and script activity immediately before the marker.

For a live view, enable Rendering → Layout Shift Regions and reload. The affected area flashes purple. Wait after load, scroll and open UI that inserts content. One quick lab run can miss a lazy widget, ad or experiment.

Record viewport width, network profile, cache state, language and cookie-consent state. A narrow screen can turn a small font change into an extra line; the same page may look stable on desktop. Compare before and after under identical conditions.

Reserve image geometry

Give an image its intrinsic dimensions so the browser can determine its ratio before downloading bytes. For a responsive image, keep max-width:100%;height:auto. If the eventual block height is variable, reserve a realistic minimum and test long content rather than choosing a huge fixed height.

<img src="/hero.webp" width="1280" height="720" alt="Service screen">
<style>img { max-width: 100%; height: auto; }</style>
# local fixture, 5 runs: no slot CLS 0.0398667; reserved slot 0

In our fixture, an image was inserted 400 ms after load above a paragraph. Five runs without a reserved container produced 0.0398667 each; five runs with a 240 px container produced zero. This isolates one mechanism at an 800×600 viewport. It is not a forecast for a production site. The fixture and measurements are saved with the draft.

Handle late blocks and fonts

Agree on ad slot dimensions with the provider. A huge empty area on a short page is also a UX cost. Prefer known creative sizes or a placement that does not reflow the document. A consent banner may overlay content, but it must not hide essential controls and must remain keyboard accessible.

For font shifts, compare fallback and final line metrics, heading height and wrapping. font-display: swap makes text visible immediately but can trigger a later reflow. optional can reduce late swaps, at the cost of some users seeing the fallback. See the web-font experiment for measured behavior.

For API content, build a skeleton whose dimensions match the card. If the response can contain two or twenty lines, a fixed height may clip content. Design a stable initial state and verify long results. Test errors too: an empty response should not collapse a large region unexpectedly.

Verify the fix

Record a second trace with the same settings and compare the worst cluster. Then test a mobile viewport, empty cache and several seconds of idle time. Use the enterno.io speed tool for a broader loading view and DevTools for the exact moving element. One green lab score is not a field verdict; users have different devices and conditions.

Keep a short regression list: image dimensions, widget slots, banner behavior, font fallback and layout-safe animations. Add it to the pre-launch checklist. If CLS remains high, inspect the next cluster rather than repeatedly changing a block already proven stable.

How we made this

On 14 November 2026 a local HTTP fixture in Chrome 154 inserted an image above text. We ran five trials each at 800×600. PerformanceObserver recorded layout-shift entries without recent input; results of 0.0398667 and zero are in lab/data.json. This is an artificial lab page, not field data from enterno.io users. We checked the metric definition and DevTools workflow against official Chrome and web.dev documentation.

Check multiple viewport sizes

A block may move text only a few pixels on a wide screen yet push a full extra line on a phone. Start with the viewport implicated by field data, then test other common widths. Capture screenshots before and after the image appears. Compare text and the position of a button the visitor might have tried to click. A shift with a small score can still interrupt an action.

For responsive images, a width attribute alone is insufficient if CSS overrides height unpredictably. Give the container the correct aspect ratio and confirm it matches the selected srcset candidate. Cards with mixed image ratios may need a consistent box and object-fit. Inspect the final layout and readability of surrounding text.

Save one trace before and after the change, including viewport width and cache state. If the shift happens only after scrolling, check lazy-loaded content below the first screen; an initial Lighthouse run may miss it. Do not add blank space above the whole page to hide one faulty component. Reserve space where the actual content appears.

FAQ

Can one CSS property fix CLS?

Only when one cause dominates. Find the largest cluster in Performance, fix its source and record again. Then inspect remaining clusters.

Why is the highlighted element not the cause?

DevTools highlights what moved. The source can be an image, banner or font above it. Match the timestamp with network and DOM changes.

Why does a lab run show zero while CrUX is poor?

Field users see other screens, networks, ads and page states. Reproduce those conditions and wait for shifts after initial load.

Sources

Check your website right now

Check your site's speed →
More articles: Performance
Performance
Gzip vs Brotli: Web Compression Compared
16.03.2026 · 1 049 views
Performance
CDN Cache Invalidation: Strategies for Fresh Content
16.03.2026 · 906 views
Performance
Latency vs Throughput: Network Performance Metrics
16.03.2026 · 790 views
Performance
What Is a CDN: How It Works, Why You Need It and How to Check
11.03.2026 · 778 views