This article explains real-world examples of Cumulative Layout Shift (CLS), shows why and how layout shifts happen, and gives actionable, proven techniques to avoid CLS for smoother user experience and better Core Web Vitals scores.
Introduction
When browsing the web, nothing is more frustrating than starting to read something and — suddenly — the page jumps, text moves, images or ads appear, and your finger/mouse click hits the wrong spot. This sudden jumpiness doesn’t just annoy users — it also undermines accessibility, readability, and trust. That behavior is what the Core Web Vital metric called Cumulative Layout Shift (CLS) measures. The lower the CLS, the more visually stable a page appears as it loads or as dynamic content is injected.
In this comprehensive guide, we’ll examine real-world examples of CLS, dig into the common causes underlying layout instability, and explore concrete, modern techniques to prevent CLS altogether — whether you run a blog, news site, e-commerce store, or dynamic web application.
What Is CLS (Visually — Real Everyday Examples)
Definition & Why It Matters
Cumulative Layout Shift quantifies how much elements on a web page shift around while the page loads or as dynamic content appears. A “layout shift” happens when content moves position unexpectedly, such that what you were seeing changes suddenly. If multiple shifts occur throughout a page load or during user interaction, CLS adds up — leading to a subpar user experience.
Good CLS practice aims for a score of 0.1 or less for at least 75% of visits; anything above ~0.25 is often considered poor, leading to visible layout instability that frustrates users. Pages with higher CLS are more likely to cause accidental clicks, reading disruption, and poorer perceptions of site quality.
Common Real-World Scenarios Causing Layout Shift
Here are common everyday scenarios that generate noticeable layout shift for users (even if subtle). These are the “real-world examples” of CLS many end-users experience unconsciously:
- Images loading without defined dimensions: A user sees a block of text; then an image loads above or below it — pushing content down and causing visible jumpiness. The text you were reading shifts position mid-scroll. This is especially common for inline images, blog photos, or dynamically loaded visuals.
- Ads or banners inserted dynamically: When ad slots are injected after the page begins rendering — often without pre-defined sizes — the content below shifts down. For users on slower connections, this delay can disrupt reading or navigation.
- Embeds, iFrames, or external widgets loading late: Embedded videos, social posts, or interactive widgets often load asynchronously and without reserved space; when they draw in, they shift surrounding content.
- Web font loading causing reflow (FOIT/FOUT): When custom fonts load after fallback fonts, text can re-render with different metrics, causing paragraphs, headings, or UI elements to shift slightly, which accumulates especially on text-heavy pages.
- Dynamic content insertion above existing content: Notifications, pop-ups, cookie-consent banners, or “load more” modules inserted at the top or near visible content after page load can shift everything downward — jarring to users.
- Late-loading CSS or style sheets applied after page render: If style rules load after initial HTML render (for instance, with delayed loading or misconfigured preload), the layout can reflow, causing shifts or jumps.
These examples aren’t hypothetical — they reflect the kinds of layout issues many websites still inadvertently expose visitors to. And because CLS adds over shifts across time or interactions, a single bad image or one ad slot can degrade the entire page’s visual stability.
Core Causes Behind CLS: What Developers and Site Owners Should Know
Understanding why CLS happens is essential to eliminating it. Often, subtle oversights in how media, embeds, fonts, or dynamic content are handled lead to layout instability. Here are the primary root causes uncovered by real-world audits and web-performance experts.
1. Media Without Defined Dimensions (Images, Videos, iFrames)
One of the most frequent culprits is images or media elements that load without explicit width/height or aspect ratio specified. Without this information at the moment of initial layout, the browser cannot reserve space. When the media finally loads, it pushes existing content down — causing a shift visible to the user.
Similarly, embedded media like videos or iFrames often arrive asynchronously. Without reserved space (via CSS aspect-ratio, width/height, or placeholder containers), these elements can reflow page layout when they render.
2. Dynamically Injected Content (Ads, Pop-ups, Widgets, Banners)
Many modern websites add ads, pop-ups, or dynamic widgets after the initial HTML load — sometimes triggered by scripts, sometimes by ad network loading. If these are inserted above existing content or near the top of the page without preallocated space, layout shifts occur. Because dynamic content can vary in size depending on context (device, ad size, screen width), these shifts can be unpredictable, making them especially harmful for CLS.
3. Web Fonts Causing Reflow (FOIT/FOUT)
Custom fonts are major layout shift contributors. When a page loads fallback fonts first and then replaces them with custom ones — or waits until the custom font downloads before showing text — it triggers re-rendering and shifting of text layout. On text-heavy pages, this can lead to noticeable jumps as the font metrics change, and in cumulative effect impact CLS significantly.
4. Late or Deferred CSS / Style Loading
In attempts to improve perceived load times or to defer render-blocking resources, some developers defer loading of CSS or style sheets. But if crucial layout styles — e.g. grids, containers, width/height rules — arrive after HTML render, the page can reflow dramatically, shifting already visible content. This practice, while sometimes improving load speed, often worsens visual stability.
5. Animations or Transitions That Trigger Layout (Not Transform-Safe)**
Not all animations are created equal. Animations or transitions that modify layout-affecting properties — such as changing width/height, margin, padding, top/left positioning — trigger re-layouts. Even seemingly small CSS changes can cause content to shift. In contrast, animations using CSS `transform` or opacity avoid layout changes by leveraging compositing, which doesn’t reflow the page. Using non-layout-safe animations can therefore degrade visual stability and raise CLS.
How CLS Is Measured — Behind the Scenes
To understand why CLS matters, it’s useful to know how browsers and performance tools quantify layout shift. CLS is calculated as the sum of all individual layout shift scores during page load and user interaction. Each individual shift is scored based on two factors:
- Impact fraction: The amount of visible viewport space affected by shifting elements (both before and after shift combined). A larger affected area increases the impact fraction.
- Distance fraction: How far, relative to viewport size, the elements moved during the shift. Bigger jumps — e.g. moving half the screen height — generate higher distance fractions.
The product of impact fraction and distance fraction gives the shift score for that event. The browser (or performance tool) adds up all shift scores to compute the final CLS value for that page. Because this metric is cumulative across a session, multiple small shifts can add up to a poor CLS score, even if each shift feels minor.
Layout shifts that occur as a result of user interaction (for example, expanding a menu after a click) are considered “expected” and typically don’t contribute to the CLS score — but shifts that happen without user input are counted, as they impact perceived stability.
What Is Considered a “Good” CLS?
Industry and Core Web Vitals guidance consider a CLS of 0.1 or lower as “good.” A CLS between 0.1 and 0.25 indicates “needs improvement,” while anything above 0.25 is generally classified as “poor” — likely to lead to visually jarring experiences, accidental clicks, and lower user satisfaction or increased bounce rates.
Thus achieving CLS ≤ 0.1 should be a core goal for web developers, content publishers, and site owners who care about usability, readability, and search-engine ranking signals tied to user experience.
Real-World Examples — Sites That Suffer (And Why)
Many real websites — from blogs to news portals to e-commerce platforms — suffer from CLS issues. Below are some typical scenarios observed by developers and performance auditors that illustrate how easily layout instability creeps in.
Example: Blog Article with Un-sized Images
A long-form blog post includes several images meant to illustrate concepts. The author embeds images without specifying width/height. On slower connections, text renders first; as each image loads, it pushes down the following paragraphs. Result: a reader halfway through a sentence suddenly finds themselves reading a different line. This disrupts reading flow, annoys users, and can even cause accidental clicks on links or “read more” buttons upon shift.
Example: Ad Banner Injected After Load on Mobile
An e-commerce site loads the page content first, then — after some milliseconds — loads ad banners or promotional widgets dynamically at the top or near content. On mobile devices, especially with narrow viewports, this causes sudden vertical shifts, shifting down text or buttons the user may have been about to press. The user might miss a button or get unintended clicks. This is a classic case of poor CLS due to dynamic ad insertion without reserved space.
Example: Video Embed or iFrame Loading Late in Article**
Suppose a news site embeds a video or social media post within an article. The initial HTML has only a placeholder or nothing; once the iFrame loads (or the embed script runs), the video slot appears and pushes down the rest of the content below it. On long articles, this might happen after the reader scrolls halfway — making it especially jarring and disrupting reading or engagement.
Example: Custom Web Fonts Causing Re-layout**
A site uses a custom font for headings and body text. On initial load, fallback fonts appear; once the custom font file loads, the text re-renders with new metrics (different letter width/height), causing paragraphs, boxes, or card layouts to reflow. On fluid or grid-based layouts, this can cause columns to shift, overlapping or misalignment — again a source of layout instability many users silently endure.
Sites with heavy lazy-loading or infinite scroll patterns**
Sites implementing lazy loading for images or infinite-scroll content — such as social feeds, product lists, or content galleries — often wait to fetch or render items only when needed. If the placeholder sizes aren’t reserved, each new chunk load can shift existing content downward. Over time, as the user scrolls, many small shifts accumulate — leading to high CLS and a jarring user experience.
Best Practices: How to Prevent CLS and Achieve Visual Stability
Preventing CLS involves proactive planning: anticipating media and dynamic content sizes, structuring the document carefully, and using modern CSS and performance techniques. Below are best practices widely adopted by performance experts and web-dev practitioners to minimize or eliminate CLS.
- Always specify width and height (or aspect-ratio) for images and media. By giving explicit dimensions (or using CSS aspect-ratio), the browser can reserve correct space before media loads, preventing content shifts. This is especially important for images, videos, embedded content, iframes, or any heavy media elements.
- Pre-allocate placeholders for dynamic content (ads, embeds, widgets). Instead of injecting content dynamically without size info, reserve container space (with a min-height or fixed size) or use placeholder skeletons. This way, when content loads, it fills reserved space — no layout shift occurs.
- Use CSS `font-display`, preload fonts, and set fallback fonts carefully. Preloading custom fonts and using `font-display: optional` (or similar) reduces re-layout when fonts arrive. Ensure fallback fonts have similar metrics to prevent dramatic reflow. Minimizing the number of font swaps reduces CLS caused by font loading.
- Avoid late or deferred layout-critical CSS. Ensure critical layout styles (grids, container sizes, responsive breakpoints) load early so layout is correct before render. If CSS must be deferred, consider inlining critical CSS or using server-side rendering to avoid blinking or reflow when styles arrive.
- Favor CSS `transform` and opacity for animations — avoid layout-triggering properties. Animations changing `top`, `left`, `width`, `height`, or margin/padding trigger re-layouts. Instead use `transform`, `translate`, `scale` or opacity changes for smooth visual transitions without reflow.
- Load dynamic/injected content after user interaction or below fold. If possible, avoid rendering ads or dynamic content in the visible viewport on initial load. Load them on scroll or via user-triggered events to reduce unexpected shifts in visible content.
- Test and measure CLS on real devices and across network speeds. Use tools like Lighthouse, PageSpeed Insights, or real-user monitoring (RUM) to detect layout shifts in actual conditions. Lab tests may miss some shifts that occur only in real-world scenarios with different devices or slower connections.
- Design responsive layouts with stability in mind. If your site adapts to different viewports or flexible grids, ensure that resizing or media queries don’t introduce unexpected reflows when content loads or fonts change. Stable layout breakpoints help avoid CLS across devices.
Checklist: Implementing CLS-Safe Practices — Step by Step
- Audit all media elements (images, videos, embeds) on your pages; ensure each has explicit width/height or aspect-ratio defined before load.
- Scan for dynamically injected content (ads, widgets, banners) and wrap them in placeholder containers with fixed or minimum size to reserve space.
- Preload any custom web fonts and set `font-display: optional` (or swap/fallback strategies) to avoid FOIT/FOUT layout shifts. Provide fallback fonts with similar metrics.
- Ensure critical CSS loads early (inline or early link) so layout styles are applied before render, avoiding reflow when style sheets are downloaded.
- When using animations or transitions, rely on CSS `transform` and opacity rather than layout properties (width/height/margin/top/left), to avoid layout-triggered shifts.
- Defer or lazy-load non-critical, below-the-fold content or content loaded upon user interaction — avoid injecting content above visible content after page load.
- Test website performance across devices, screen sizes, and network speeds. Use real-user monitoring where possible to catch CLS the way real users experience it.
- Continuously monitor CLS scores in Lighthouse, PageSpeed Insights, or RUM tools. Re-audit after design changes, new ads/widgets/app integrations, or layout updates.
Pro Tips from Web Performance Experts
- Reserve space early using CSS aspect-ratio rather than explicit width/height when responsiveness is needed. This is especially useful for fluid, responsive layouts where fixed dimensions may break design. Aspect-ratio ensures the container scales but reserves space to prevent jumps.
- Use skeleton screens or placeholder content for lazy-loaded content. Instead of blank white space, skeleton boxes (light gray placeholders) signal that content is loading — preserving layout space and improving perceived performance and stability.
- Audit third-party scripts carefully (ads, social embeds, analytics). Third-party embeds are a frequent source of CLS; delay their loading if possible, load them asynchronously, or sandbox them with fixed-size containers to prevent unexpected layout shifts.
- Balance font optimization and layout stability. Preloading fonts helps avoid reflow, but preloading too many or heavy font files may hamper load performance. Prioritize only critical fonts. Use fallback fonts with close metrics to minimize reflow when the custom font arrives.
- Prefer composited animations (transform/opacity) over layout-triggering animations. Use `transform` or opacity transitions for UI effects, scroll-based animations, or interactive elements — these run on the GPU and avoid layout shifts, giving smoother UX without CLS risk.
Frequently Asked Questions (FAQ)
Is a small layout shift always bad for CLS?
Not necessarily. A layout shift caused by user interaction (e.g. expanding a menu after a click) is expected and typically not counted toward CLS. What matters is unexpected shifts — those that happen without user input during loading or dynamic content insertion. Minimizing those is the core goal.
Can lazy-loading images cause CLS even if they improve load speed?
Yes — if lazy-loaded images or media don’t have reserved space (via width/height or aspect-ratio), they can still push content as they load, causing layout shifts. To avoid CLS, combine lazy-loading with placeholders or reserved space so the layout remains stable.
Do animations always trigger CLS problems?
Only if they affect layout-triggering properties (like top/left, width/height, margin, padding). Animations using CSS `transform` or opacity are safer: they don’t cause re-layout or reflow and therefore avoid contributing to CLS.
What CLS score should I aim for?
The target is a CLS score of 0.1 or less for at least 75% of page loads or user visits. A score between 0.1 and 0.25 needs improvement; anything above ~0.25 is likely to cause noticeable layout instability and degrade user experience.
How can I check if my site suffers from CLS?
Use tools like Google Lighthouse, PageSpeed Insights, or real-user monitoring libraries to measure CLS. Inspect performance panels or use the `web-vitals` library for dynamic measurement. Additionally, loading your site on slow connections or after clearing cache can reveal layout shifts that don’t show up on fast networks.
Conclusion
Cumulative Layout Shift (CLS) is a critical but often underestimated aspect of web performance and user experience. Layout shifts — from un-sized images, dynamically inserted ads or embeds, font loading, deferred CSS, or layout-triggering animations — disrupt user flow, lead to accidental clicks, frustrate readers, and harm page-perceived quality. As web-sites increasingly compete on user experience and speed, visual stability is as important as load speed or interactivity.
By adopting a proactive, consistent approach — specifying media dimensions, reserving space for dynamic content, preloading fonts, using layout-safe animations, and testing across network and device conditions — you can dramatically reduce or eliminate CLS. A well-optimized page that loads smoothly and stably doesn’t just delight users — it also performs better under real-user metrics and aligns with modern performance and SEO standards.
Implementing the practices outlined above ensures that your site delivers stability, trust, and usability — reducing layout shifts for all visitors, regardless of device or connection speed. Prioritize CLS, and you’ll build web pages that feel polished, professional, and user-friendly from first paint to full load.












