Avoid Cumulative Layout Shift: Stable Shops
An online shop whose content jumps around while loading erodes trust and revenue. That is exactly what Cumulative Layout Shift (CLS) captures as one of the three Core Web Vitals: the unexpected movement of visible elements during page rendering. In 2025, 72 percent (HTTP Archive Web Almanac 2025) of desktop pages and 81 percent (HTTP Archive Web Almanac 2025) of mobile pages reach a good CLS value below 0.1 -- yet data-dense shop templates with images, reviews, ad slots and late-loading scripts regularly belong to the unstable minority. This article explains the common causes of CLS, their measurable impact and concrete countermeasures for stable layouts. Anyone who takes their performance strategy seriously treats layout stability not as a cosmetic detail but as a conversion and ranking lever.
What Cumulative Layout Shift Actually Measures
Cumulative Layout Shift quantifies how much visible elements shift unexpectedly during loading -- movements the user did not trigger themselves. A CLS value below 0.1 is considered good, between 0.1 and 0.25 needs improvement and above that is poor (Source: Google web.dev). Unlike loading metrics, this is not about speed but about visual stability: if the order button jumps down at the moment of the click because a banner snaps in above it, the click lands on the wrong element.
The CLS score of an individual layout shift is calculated from two factors: the impact fraction (what share of the viewport is affected by the shift) and the distance fraction (how far the element moves relative to viewport height). An element covering half the visible area that shifts down by a quarter of the viewport height yields a shift score of 0.125 (0.5 times 0.25) (Source: Google web.dev). These scores are not added up arbitrarily but grouped within session windows.
Session Windowing: How the Final CLS Value Is Formed
Important for evaluation: for ranking, Google uses only real-user field data from the 75th percentile. A value that looks clean in the lab says little if real users on slower devices or connections experience stronger shifts. A robust performance analysis therefore combines lab and field data to capture both the cause and the real frequency of a shift.
0.1
CLS good threshold (Google web.dev)
72%
desktop pages good (Web Almanac 2025)
81%
mobile pages good (Web Almanac 2025)
5s
max. session window (Google web.dev)
Images Without Dimensions: The Most Common Cause
By far the most common source of CLS is images and media without reserved dimensions. According to the Web Almanac 2025, 62 percent (HTTP Archive Web Almanac 2025) of all mobile pages have at least one image without explicit dimensions, and the median page contains two such images -- rising to 25 at the 90th percentile (Source: HTTP Archive Web Almanac 2025). Without a width and height attribute, the browser does not know how much space the image needs before loading, renders the following content upward and then pushes it down once the image arrives.
The fix is unspectacular but effective: every ,
<!-- Stable: dimensions reserved, no shift -->
<img
src="product.avif"
width="800"
height="1000"
alt="Product name"
style="width:100%;height:auto"
fetchpriority="high"
>
<!-- Placeholder for content with variable ratio -->
<div style="aspect-ratio:4/3;background:#f1f5f9">
<img src="gallery.avif" alt="..." loading="lazy">
</div>In shop systems it pays to look at the template level: product tiles, galleries and sliders are usually generated centrally. Once dimensions are handled cleanly there, all pages benefit at once. How to deliver the right formats and sizes without burdening LCP and bandwidth is explored in our article on image optimization with WebP and AVIF.
Web Fonts and the Invisible Text Jump
When a custom web font arrives only after the first render, the browser swaps the initially shown fallback font for the target font. If the two differ in character width and line height, the entire text reflows -- a classic, often overlooked layout shift. The problem is widespread: only 11 percent (HTTP Archive Web Almanac 2025) of all pages preload their web fonts, so the vast majority remain vulnerable to font-swap shifts.
- font-display: swap shows text immediately and swaps later -- combined with a metrically matched fallback font, the line breaks stay stable.
- size-adjust, ascent-override and descent-override in the @font-face rule tune the fallback to occupy the same space as the target font.
- Preloading critical fonts via shortens the window during which any swap occurs at all.
- font-display: optional skips the swap if the font does not arrive in time -- the shift is eliminated entirely, but the fallback font is occasionally kept.
- Self-hosting fonts avoids an extra connection setup to third parties and speeds up delivery.
The combination of a metrically matched fallback and preload defuses most font shifts without making users wait for invisible text. Which loading strategy suits which font type and how to determine the override values is covered in detail in our article on web font performance.
Ads, Embeds and Late-Injected Content
Ad slots, product review widgets, chat tools and social media embeds often insert their content into the DOM only after the initial render. If no space is reserved for them, they push everything below them downward. In a documented case study, a shop's bounce rate fell by 20 percent and its conversion rate rose by 15 percent (Source: Web-Performance-Benchmarks) after fixed placeholders were reserved for ad areas. This illustrates that layout stability directly affects business results.
| Element | Unstable pattern | Stable solution |
|---|---|---|
| Ad slot | Slot grows to ad size, pushes content | Container with fixed min-height at expected size |
| Review widget | Injected after loading | Reserved area with skeleton placeholder |
| Cookie banner | Snaps in at top, pushes page down | position: fixed as overlay, no flow impact |
| Chat/support button | Shifts footer elements | position: fixed in its own layer |
| Late-loading navigation | Sticky header jumps on scroll | Height defined upfront via CSS |
The common denominator: anything that does not need to sit in the document flow belongs in its own layer via position: fixed or position: absolute. Anything that unavoidably claims space in the flow gets that space reserved upfront -- ideally at the realistically expected size, so the slot does not grow further once filled.
Cookie Banners and Consent Layers as a CLS Trap
Animations and Dynamic Height Changes
Not every movement counts toward CLS -- changes triggered by the user within 500 milliseconds of the interaction are exempt. Problematic, however, are automatic, unrequested shifts: accordions expanding without reserved space, expanding banners or animations running via top, height or margin instead of transform. According to the Web Almanac 2025, 39 percent (HTTP Archive Web Almanac 2025) of mobile pages have non-composited animations that can contribute to layout shifts.
The rule is clear: movements should be implemented via transform: translate() and opacity, because these properties run on the compositor layer and do not trigger a layout reflow. Changes to width, height, top or left, by contrast, force the browser into another layout pass and can shift surrounding elements. How compute-heavy responses additionally affect interactivity is examined in the context of Core Web Vitals 2026.
/* Unstable: triggers reflow and a potential shift */
.panel { transition: height 0.3s, margin-top 0.3s; }
/* Stable: runs on the compositor layer, no layout shift */
.panel {
transition: transform 0.3s, opacity 0.3s;
will-change: transform;
}
/* Reserve space for expanding content upfront */
.accordion { min-height: 220px; }Finding CLS in Shop Templates Systematically
A shop rarely has a global CLS problem but rather template-specific weak spots. Product detail pages with galleries, category pages with late-loading filters and the cart with dynamic totals behave completely differently. That is why an analysis per template type is worthwhile instead of only at the origin level. The browser developer tools highlight every layout shift visually and name the responsible element -- so the largest contributor in the session window can be identified precisely.
- Collect field data per template type, not just the origin average.
- Test in the lab with throttled network and CPU, since shifts are stronger on slow devices.
- Isolate the largest shift burst in the session window and name the triggering element.
- Implement the measure (dimensions, placeholder, font override, overlay) and measure again.
- Anchor a CLS ceiling as a performance budget in the CI/CD pipeline to prevent regressions.
Layout Stability Is a Process, Not a One-Off Fix
For Shopware projects on an open-source basis, this means in practice: anchor image dimensions in the storefront theme, self-host web fonts with override values, move consent and marketing scripts into fixed layers and equip ad slots with fixed slot heights. These measures interlock and are ideally bundled as part of a comprehensive frontend optimization rather than being added piecemeal.
Size your media
Give all images, videos and iframes width/height or aspect-ratio -- centrally in the template, not per page.
Stabilize fonts
Metrically matched fallback via size-adjust and override values, preload critical fonts, self-hosting.
Reserve space
Ad slots, widgets and banners with fixed slot heights, overlays as position fixed outside the flow.
Why CLS Is Penalized More on Mobile
The very same layout shift weighs noticeably more on a smartphone than on a desktop. The reason lies in the calculation: the distance fraction relates the shift to viewport height, and mobile viewports are narrower and shorter. A shift of the same number of pixels therefore corresponds to a larger fraction of the visible area and produces a higher shift score. The same root cause is thus penalized more heavily on a phone (Source: Google web.dev). On top of that, mid- and lower-tier mobile devices load images and fonts more slowly, which widens the window for late shifts.
Remarkably, the field data nonetheless paints a different picture: in 2025, mobile pages reach a higher share of good CLS values at 81 percent (HTTP Archive Web Almanac 2025) than desktop pages at 72 percent (HTTP Archive Web Almanac 2025). This is mainly due to widespread mobile frameworks and themes that ship image dimensions and fixed container heights by default. Those running a custom shop frontend, however, cannot rely on this effect and should test mobile templates deliberately with a throttled profile. This relationship is also explored in our article on mobile performance optimization.
Layout stability is not an end in itself. Every prevented mis-click on a jumping button is an order that was not abandoned -- and thus a direct contribution to the conversion rate.
Implementing Stable Layouts in Shopware Storefronts
In a Shopware storefront on an open-source basis, the typical CLS culprits sit at recurring spots. The product image component should write width and height directly from the media data into the markup so the browser knows the aspect-ratio before the image loads. Sliders and galleries on the homepage need a container with a fixed height or defined aspect ratio, since they are often initialized via JavaScript and would otherwise collapse and reopen during setup. Review and cross-selling blocks loaded via AJAX belong in a reserved area with a skeleton placeholder.
At the theme level, consistent discipline pays off: a central @font-face definition with override values prevents font shifts on all pages at once instead of retrofitting them per template. Marketing and tracking scripts embedded via the theme manager should not write visible elements into the document flow -- otherwise they get a fixed layer. This work belongs in the context of comprehensive Shopware performance care that considers layout stability, loading time and interactivity together rather than chasing isolated individual fixes.
- Product image component writes width/height from media data into the markup.
- Sliders and galleries with a fixed container height or defined aspect-ratio.
- AJAX blocks (reviews, cross-selling) in a reserved area with a skeleton.
- Central @font-face definition with size-adjust and override values in the theme.
- Consent and marketing scripts in fixed layers instead of the document flow.
- CLS budget anchored in the build so new extensions do not introduce regressions.
The decisive advantage of this template-centric approach: once a component is built cleanly, it stays stable across all products, categories and landing pages. Point fixes to individual pages, by contrast, evaporate as soon as new content is served through the same faulty template. Layout stability therefore scales precisely when it is anchored at the root -- in the reused building block -- and not at the leaves of the page tree.
Fix at the root
Corrections in the reused template affect all pages -- point fixes evaporate with the next piece of content.
Measure per template
Product page, category and cart behave differently. Field data per template type, not just the origin average.
Prevent regressions
A CLS budget in the pipeline protects achieved values from new plugins, themes and marketing scripts.
Sources and Studies