Cumulative Layout Shift (CLS)
Page content stays in place as the page loads.
Link copied!
On this page
Impact
About
Cumulative Layout Shift (CLS) measures how much a webpage's content unexpectedly moves during loading, affecting user experience. A good CLS score is 0.1 or less. Common causes include images or ads without specified dimensions, dynamically added content, and late-loading fonts. To improve CLS, always set size attributes for media, reserve space for ads, and ensure fonts load properly.
Risks
Users click wrong buttons by mistake.
Why it's important
Minimizes unexpected page movements, improving user experience by keeping content stable while it loads.
User stories
As a user reading the page, I want the content to stay stable while loading so that I don't accidentally click the wrong thing or lose my place.
Code
Failing pattern:
/* Fail: no dimensions causes layout shift when image loads */
img { max-width: 100%; }
Passing pattern:
/* Pass: reserve space with aspect-ratio or explicit dimensions */
img {
max-width: 100%;
height: auto;
aspect-ratio: 16 / 9;
}
Error
ScanGov messaging when a site fails a standard:
Unexpected layout shifts detected.
Guidance
Indicators
Related
- Page title
- Page description
- Readability
- Viewport meta tag
- www resolution
- First Contentful Paint (FCP)
- Interaction to Next Paint (INP)
- Largest Contentful Paint (LCP)
- Time to First Byte (TTFB)
- Open Graph site name
- Open Graph type
- Open Graph title
- Open Graph description
- Open Graph URL
- Open Graph image
- Open Graph image alt
- Usability grades on Project ScanGov
- ScanGov Usability
On this page