Close Menu
geekfence.comgeekfence.com
    What's Hot

    refurbed and GoPro announce exclusive partnership in Ireland

    March 28, 2026

    Enterprise Network Trends & Strategy: WAN Manager Survey Insights

    March 28, 2026

    Posit AI Blog: De-noising Diffusion with torch

    March 28, 2026
    Facebook X (Twitter) Instagram
    • About Us
    • Contact Us
    Facebook Instagram
    geekfence.comgeekfence.com
    • Home
    • UK Tech News
    • AI
    • Big Data
    • Cyber Security
      • Cloud Computing
      • iOS Development
    • IoT
    • Mobile
    • Software
      • Software Development
      • Software Engineering
    • Technology
      • Green Technology
      • Nanotechnology
    • Telecom
    geekfence.comgeekfence.com
    Home»Software Development»Fixing Cumulative Layout Shift Problems on DavidWalshBlog
    Software Development

    Fixing Cumulative Layout Shift Problems on DavidWalshBlog

    AdminBy AdminFebruary 8, 2026No Comments5 Mins Read1 Views
    Facebook Twitter Pinterest LinkedIn Telegram Tumblr Email
    Fixing Cumulative Layout Shift Problems on DavidWalshBlog
    Share
    Facebook Twitter LinkedIn Pinterest Email

    Over 50 thousand developers visit DavidWalshBlog every month from around the world to learn JavaScript tricks and fix problems in their code. Unfortunately, some of them have a slow experience on the site.

    David tracks the performance of his Core Web Vitals and overall performance with Request Metrics. Recently, we noticed that his CLS performance score was trending pretty slow for both desktop and mobile users.

    Fixing Cumulative Layout Shift Problems on DavidWalshBlog

    Wait, what is CLS?

    Cumulative Layout Shift (CLS) is one of the Core Web Vital performance metrics. It doesn’t measure load time directly, instead it measures how much a page shifts while it is being loaded. You’ve definitely seen this and been annoyed by it. These shifts make a site feel slow to a user.

    CLS and the rest of the Core Web Vitals are super important. Not only because they measure user experience, but also because they influence the pagerank of a site in search. And search traffic is life for bloggers, media sites, e-commerce stores, and pretty much everyone with a website.

    If we can fix the site’s CLS problem, we’ll give readers a faster experience, and boost the search ranking so David can help even more people. Sounds like a great incentive, let’s figure it out.

    Crashing with Google Lighthouse

    To find a performance problem, many developers will use a tool like Google Lighthouse. I ran a Lighthouse report on David’s site, and here’s what I got.

    A perfect score! Let’s pack it up and go home.

    The trouble is that Google Lighthouse is a lie. Real users won’t have this performance. That score only represents a single test, from my lightning-fast computer, in the USA, on a fast broadband connection.

    David’s real users come from all over the world, on varying devices and networks, and at all times of the day. Their performance experience is far from perfect. That’s why we need to get real user monitoring for the performance, otherwise we might never know that there is a problem.

    Where are the CLS problems?

    David has been writing for a long time and has hundreds of posts on his site. Request Metrics tracks the CLS score per page so we can zero-in on the problems.

    The largest traffic page is the root page, and that has a good CLS. But many of his posts, like Play Grand Poo World and Pornhub Interview have troubling CLS scores. We can also track the elements responsible for CLS, and for most of the posts its main > article > p. That means the first paragraph of the article is the thing shifting. Why would it do that?

    What is common about these posts with the worst CLS scores? Images. Images are a very common cause of CLS problems because a browser doesn’t always know how big an image is until it’s downloaded. The browser assumes it’s 0x0 until it has the image, then shifts everything around it to make room.

    Posts with lots of images would shift many times as each image was downloaded and the article shifted to make room for the new content.

    Using images correctly for CLS

    To avoid layout shifts when using images, we need to give the browser hints about how big the images will be. The browser will use these hints to reserve space in the layout for the image when it’s finished downloading.

    
    

    Notice that the width and height are specified as their own attributes — not part of a style tag. These attributes set both a base size of the image as well as the aspect ratio to use. You can still use CSS to make the image bigger or smaller from here.

    Also notice that there is no px unit specified.

    Image Sizes in WordPress

    DavidWalsh.name is hosted on WordPress, where there are some built-in tools to do this. We can utilize wp_image_src_get_dimensions to get the dimensions of images he’s using and add them to the markup.

    Proving it works

    David made the image changes a few days ago, and we’re already seeing an improvement. CLS has dropped 20% to 0.123. We’re real close to the “Good” range of CLS now.

    There’s still some issues to sort out around fonts, but that will be a story for another time and another post.

    If you’re looking to improve the real performance of your site, or worried about losing your SEO juice from Core Web Vital problems, have a look at Request Metrics. It’s got the tools to track your performance and actionable tips to actually fix the problems.

    Plus it’s free, so it’s got that going for it.

    Request Metrics real user monitoring
    Request Metrics real user monitoring
    Todd Gardner

    About Todd Gardner

    Todd Gardner is a software entrepreneur and developer who has built multiple profitable products. He pushes for simple tools, maintainable software, and balancing complexity with risk. He is the cofounder of TrackJS and Request Metrics, where he helps thousands of developers build faster and more reliable websites. He also produces the PubConf software comedy show.

    www.toddhgardner.comtoddhgardnerPosts



    Source link
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    Shadow AI : How to deal with unauthorized models and uncontrolled agents

    March 28, 2026

    What Is CI & CD? Understanding Continuous Integration and Delivery Pipelines

    March 24, 2026

    Why Modernizing Your Data Architecture Means More Than Just Moving Your Data

    March 23, 2026

    Strategies for Modernizing Legacy Systems

    March 19, 2026

    Harness Launches Two Major Initiatives to Secure the Future of AI-Powered Software Delivery

    March 18, 2026

    Credit Scoring Software Development: Ultimate Guide for FinTech

    March 14, 2026
    Top Posts

    Understanding U-Net Architecture in Deep Learning

    November 25, 202527 Views

    Hard-braking events as indicators of road segment crash risk

    January 14, 202624 Views

    Redefining AI efficiency with extreme compression

    March 25, 202619 Views
    Don't Miss

    refurbed and GoPro announce exclusive partnership in Ireland

    March 28, 2026

    refurbed, Ireland’s leading online marketplace for refurbished goods, has launched an exclusive new partnership with…

    Enterprise Network Trends & Strategy: WAN Manager Survey Insights

    March 28, 2026

    Posit AI Blog: De-noising Diffusion with torch

    March 28, 2026

    The Path to Agentic-Ready Data: Takeaways from the Gartner Data & Analytics Summit

    March 28, 2026
    Stay In Touch
    • Facebook
    • Instagram
    About Us

    At GeekFence, we are a team of tech-enthusiasts, industry watchers and content creators who believe that technology isn’t just about gadgets—it’s about how innovation transforms our lives, work and society. We’ve come together to build a place where readers, thinkers and industry insiders can converge to explore what’s next in tech.

    Our Picks

    refurbed and GoPro announce exclusive partnership in Ireland

    March 28, 2026

    Enterprise Network Trends & Strategy: WAN Manager Survey Insights

    March 28, 2026

    Subscribe to Updates

    Please enable JavaScript in your browser to complete this form.
    Loading
    • About Us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • Terms and Conditions
    © 2026 Geekfence.All Rigt Reserved.

    Type above and press Enter to search. Press Esc to cancel.