WebSeoSG - Online Knowledge Base - 2025-09-04

Best Practices to Reduce CLS: Image Dimensions, Font Loading, and Third-Party Scripts

Best practices to reduce Cumulative Layout Shift (CLS) focus on stabilizing the page layout during loading by managing image dimensions, font loading, and third-party scripts effectively.

  1. Define Image and Video Dimensions Explicitly
    Always specify the width and height attributes for images, videos, and iframes in the HTML markup. This reserves the exact space needed before these elements load, preventing sudden layout shifts when they appear. Alternatively, use the CSS aspect-ratio property to maintain the correct space dynamically. This ensures the browser allocates the right amount of space upfront, improving visual stability.

  2. Optimize Font Loading
    Web fonts can cause layout shifts when they load and replace fallback fonts, changing text size or spacing. To reduce this:

  • Use the preload attribute to load fonts early.
  • Consider font-display strategies like swap to minimize invisible text or reflows.
  • Optimize font subsets to reduce load time.
    Proper font loading prevents text from jumping or resizing after initial render.
  1. Manage Third-Party Scripts and Dynamic Content
    Third-party ads, embeds, and scripts often inject content dynamically, causing layout shifts. To mitigate this:
  • Reserve space for ads and embeds by setting fixed dimensions or minimum heights in CSS before the content loads.
  • Use placeholders or skeleton screens to maintain layout structure.
  • Avoid injecting content that changes layout size after initial load without reserved space.
  • Lazy load offscreen content but ensure dimensions are defined to prevent shifts when they appear.

Additional Tips:

  • Prefer CSS transform properties for animations instead of properties that trigger layout recalculations.
  • Monitor CLS scores regularly using tools like Google PageSpeed Insights or Web Vitals to identify and fix new issues.

Implementing these practices helps maintain a stable visual experience, improving user engagement and Core Web Vitals scores.

Internet images

WebSeoSG offers the highest quality website traffic services in Singapore. We provide a variety of traffic services for our clients, including website traffic, desktop traffic, mobile traffic, Google traffic, search traffic, eCommerce traffic, YouTube traffic, and TikTok traffic. Our website boasts a 100% customer satisfaction rate, so you can confidently purchase large amounts of SEO traffic online. For just 40 SGD per month, you can immediately increase website traffic, improve SEO performance, and boost sales!

Having trouble choosing a traffic package? Contact us, and our staff will assist you.

Free consultation

Free consultation Customer support

Need help choosing a plan? Please fill out the form on the right and we will get back to you!

Fill the
form