CLS Optimization – Eliminate Layout Shifts

Optimizing CLS (Cumulative Layout Shift)

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Our competencies:

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1281
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1237
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    977
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1026
  • image_website-sbh_0.webp
    Website development for SBH Partners
    1103
  • image_website-_0.webp
    Website development for Red Pear
    550

Optimizing CLS (Cumulative Layout Shift)

Imagine a user hovering over the "Buy" button when a banner ad loads—the button shifts downward, the click misses. This is Cumulative Layout Shift (CLS). According to Google, sites with CLS above 0.25 lose up to 15% of conversions. For an e-commerce store with a monthly turnover of 10 million rubles, that's a direct loss of 1.5 million. Our team consists of engineers with 10+ years of experience, having completed over 200 Core Web Vitals optimization projects. We evaluate your project in one day and guarantee a result of CLS ≤ 0.1.

Why CLS Matters for Business

According to Google's research, sites with high CLS can lose up to 15% of conversions. The median CLS for top 1000 sites (from CrUX) is 0.15, while sites with CLS > 0.25 see a 32% higher bounce rate. Users get annoyed when content jumps, especially on mobile with slow connections. For e-commerce, news portals, and SPAs, this is critical: every pixel of shift can lose a customer. Investing in CLS optimization pays off within 2-3 months through increased conversion and reduced abandonment.

How We Optimize CLS

Our process has four stages: audit → fix common issues → test → report. During the audit we use Chrome DevTools, Lighthouse, and PerformanceObserver to collect precise metrics, then rank issues by impact on CLS. We fix images first—they cause 80% of shifts—then fonts and dynamic content. Below is a complete checklist.

Problem Solution CLS Impact
Images without dimensions width/height + aspect-ratio 80% of cases
Fonts with font-display: swap font-display: optional + size-adjust 10-20%
Dynamic ads/widgets min-height + contain: layout 5-15%
Layout animations Use transform/opacity 0% after replacement

Images – the most common cause

<!-- Bad: browser doesn't know size before load --> <img src="product.webp" alt="..."> <!-- Good: width and height attributes --> <img src="product.webp" width="800" height="600" alt="..."> 

Responsive CSS preserving aspect ratio:

img { max-width: 100%; height: auto; } .product-image { aspect-ratio: 4 / 3; width: 100%; object-fit: cover; } 

Fonts and FOUT

font-display: swap causes layout shift when the primary font loads and replaces the fallback. Use font-display: optional or tune size-adjust:

@font-face { font-family: 'Inter'; src: url('/fonts/inter.woff2') format('woff2'); font-display: optional; } @font-face { font-family: 'InterFallback'; src: local('Arial'); size-adjust: 107%; ascent-override: 90%; descent-override: 22%; line-gap-override: 0%; } body { font-family: 'Inter', 'InterFallback', sans-serif; } 

Tools like fontaine or next/font automatically compute size-adjust. Comparison of font-display values:

Value Behavior CLS Impact
swap Immediate fallback, font swap High (FOUT)
optional Short block, fallback, swap not guaranteed Low
block Text invisible until font loads None
fallback Short block, fallback, quick swap Medium

Dynamic Content and Skeletons

For ad blocks and widgets, set a minimum height and use contain: layout. Don't leave space empty—show skeleton placeholders with correct dimensions:

.skeleton-image, .skeleton-title, .skeleton-price { background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; } @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } } 

Why transform/opacity beat layout animations?

Animations that change layout properties (width, height, top, left, margin, padding) trigger geometry recalculations and reflows—a direct path to CLS. transform and opacity do not affect the layout, so they are perfectly safe. Replacing layout animations with transform/opacity reduces CLS by 5–10x. Example:

/* Good – only transform */ .modal { animation: slideDown 300ms; } @keyframes slideDown { from { transform: translateY(-100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } } 

For isolated components, use contain: layout to prevent internal changes from affecting external layout.

How to Diagnose CLS

To spot issues, use Chrome DevTools: Performance tab → record → look for purple "Layout Shift" marks. Or install a PerformanceObserver in code: new PerformanceObserver(...). This lets you track shifts in real time.

What's Included in the Work

  • Analysis of all pages (Core Web Vitals, N+1 queries, bundle splitting)
  • Fix images (width, height, aspect-ratio, lazy loading with sizes)
  • Replace font-display: swap with optional + size-adjust
  • Fix sizes of ad blocks and dynamic widgets
  • Replace layout animations with transform/opacity
  • Add skeleton screens with shimmer effects
  • Report with before/after metrics (Lighthouse, CrUX)

Common Optimization Mistakes

Developers often set width/height as percentages without aspect-ratio—the browser can't compute the height before load. The correct fix: combine width: 100% with aspect-ratio or use a fixed height via padding-bottom. Another frequent mistake: using font-display: swap without size-adjust; the fallback font may be narrower or wider, causing shift.

Source: web.dev/cls – official Google documentation

Optimization timeline: 1–3 days for basic fixes, up to 5 days for a comprehensive audit. We are Google-certified in Core Web Vitals—we guarantee metric improvements and conversion lifts. Order a consultation and get a free preliminary assessment. Get a project estimate in one day—contact us, and we'll run an audit.