What does Google say about SEO? /
Quick SEO Quiz

Test your SEO knowledge in 3 questions

Less than 30 seconds. Find out how much you really know about Google search.

🕒 ~30s 🎯 3 questions 📚 SEO Google

Official statement

Fixing CLS issues can be as simple as including image dimensions in your HTML markup. This way, the browser knows exactly how much space to reserve for the image.
🎥 Source video

Extracted from a Google Search Central video

💬 EN 📅 06/05/2022 ✂ 11 statements
Watch on YouTube →
Other statements from this video 10
  1. Le CLS est-il vraiment un facteur de classement Google à part entière ?
  2. Vos images sabotent-elles votre CLS sans que vous le sachiez ?
  3. Les données de laboratoire suffisent-elles vraiment pour optimiser vos Core Web Vitals ?
  4. Pourquoi le Chrome User Experience Report change-t-il la donne pour mesurer les performances réelles de votre site ?
  5. Le LCP mesure-t-il vraiment la vitesse d'affichage du contenu principal ?
  6. Faut-il vraiment prioriser le chargement de vos images héros pour améliorer le LCP ?
  7. Faut-il vraiment désactiver le lazy loading sur les images above the fold ?
  8. Pourquoi PageSpeed Insights est-il l'outil de performance à privilégier pour le SEO ?
  9. HTTP/2 peut-il vraiment booster les performances de votre site sans refonte technique ?
  10. Faut-il vraiment passer toutes ses images en WebP pour le SEO ?
📅
Official statement from (3 years ago)
TL;DR

Alan Kent asserts that adding width and height attributes to images in HTML allows browsers to reserve the necessary space before loading, thus preventing layout shifts. This straightforward practice can resolve a significant portion of CLS issues without requiring complex JavaScript interventions. Whether this single action suffices across all contexts remains to be seen.

What you need to understand

How do image dimensions influence CLS?

The Cumulative Layout Shift (CLS) measures visual instability on a page — every time an element moves without user interaction, the score degrades. Images without explicit dimensions pose a classic problem: the browser doesn't know their final size before downloading them.

The result? It first displays an empty or arbitrary space, then reflows the page once the image loads. This abrupt shift penalizes CLS, especially on mobile where bandwidth is unpredictable.

What does "specifying dimensions" actually mean?

It means adding the width and height attributes directly to the <img> tag. These values don't need to be exact pixel measurements — CSS can resize them via max-width: 100% — but they must respect the aspect ratio of the image.

The browser uses this information to calculate the necessary space as soon as it parses the HTML, before even downloading the file. It's a native mechanism, fast, and requires no third-party library.

Is this practice new or just being reminded?

It already existed in early W3C recommendations but was largely abandoned with the rise of responsive design. Many developers removed these attributes out of fear that they would rigidify the layout.

Except modern browsers have evolved: they now understand intrinsic aspect-ratio and adjust reserved space even when CSS resizes the image. Google is simply reviving a forgotten best practice, adapted to Core Web Vitals.

  • HTML dimensions allow the browser to pre-allocate space before download
  • CSS can still control the final size via width: 100% and height: auto
  • This method works natively without JavaScript or frameworks
  • The aspect ratio must be respected to avoid distortion
  • Lazy-loaded images also benefit from this treatment

SEO Expert opinion

Is this statement consistent with real-world observations?

Yes, and it's even one of the most effective interventions for quickly fixing CLS. On sites where images lacked dimensions, we regularly observe CLS reductions of 30 to 50% just by adding width and height. No magic, just browser mechanics.

However — and Alan Kent doesn't specify this — this solution only fixes layout shifts caused by images. If your CLS stems from ads injected dynamically, cookie banners without reserved space, or web fonts that reflow text, specifying image dimensions won't change anything. You need to diagnose the real cause before applying the remedy.

In which cases is this technique insufficient?

Images whose ratio changes by viewport — typically via <picture> or srcset with different crops — can be problematic. If the desktop image is 16:9 and the mobile version is 4:3, specifying a single pair of dimensions isn't enough. [To verify]: some modern frameworks handle this via CSS custom properties, but it's not exhaustively documented by Google.

Another tricky case: images loaded via JavaScript after user interaction. If your script inserts an <img> tag without dimensions into the DOM, the browser has no way to anticipate the necessary space. You then need to dimension the parent container in CSS or calculate the ratio before injection.

Watch out for CMSs and builders that auto-generate image markup. Some strip width/height attributes to "simplify" the code, negating the entire benefit. Check the final rendered HTML, not just the back-office.

What's the best method for implementing this at scale?

On a site with a few pages, you can fix things manually. On a site with thousands of URLs and images managed by non-technical editors, you need to automate at the server or templating system level. WordPress has done this natively since version 5.5, but only if the theme doesn't override these attributes.

For custom sites, the ideal approach is to extract EXIF metadata or read dimensions when uploading, then store these values in a database. The template then injects them into the HTML. If you use an image transformation CDN, some like Cloudinary or Imgix can add these attributes automatically via their SDK.

Practical impact and recommendations

What concretely should you do on your site?

First step: audit the HTML of your main pages. Inspect <img> tags and verify if width and height are present. A Chrome DevTools script can list all images without dimensions in seconds.

Next, determine where these tags are generated. WordPress theme? Liquid template on Shopify? React component? Once the source is identified, add the attributes either manually or via a hook or templating helper.

For already-published images, you can retrieve their dimensions via a server script that parses files with a library like ImageMagick or Sharp (Node.js). Store these values in a database or JSON file, then inject them during rendering.

How do you verify that the implementation actually fixes CLS?

Use PageSpeed Insights or Lighthouse in mobile mode to measure CLS before/after. Compare scores across multiple representative pages, not just the homepage. CLS can vary greatly depending on content.

Additionally, open Chrome DevTools, Performance tab, and record page load with 3G throttling. The timeline will visually show you when layout shifts occur. If images no longer appear as a source of shift, you've succeeded.

  • Audit <img> tags to identify those without width/height
  • Verify that the specified ratio matches the actual image dimensions
  • Test responsive behavior: the image shouldn't distort with width: 100%; height: auto;
  • Check that lazy-loaded images also retain their dimensions
  • Measure CLS before/after with PageSpeed Insights and Chrome DevTools
  • Automate dimension extraction at upload time or build time
  • Verify that your CMS or framework doesn't strip these attributes during rendering
Specifying image dimensions is a simple and effective way to reduce CLS, but it doesn't replace a comprehensive diagnosis of layout shift sources. If your Core Web Vitals scores remain problematic despite this optimization, other elements are likely at fault. Bringing your site into compliance with Core Web Vitals can quickly become complex, especially at scale or with heterogeneous tech stacks. Engaging a specialized SEO agency allows you to obtain thorough audits and a customized action plan, tailored to your specific technical environment.

❓ Frequently Asked Questions

Dois-je spécifier les dimensions en pixels ou en unités relatives ?
Utilisez les pixels réels de l'image dans les attributs HTML width et height. Le CSS se chargera ensuite de l'adapter au viewport avec max-width: 100% et height: auto. Le navigateur calcule le ratio d'aspect à partir des valeurs en pixels.
Que faire si l'image change de ratio selon le breakpoint (picture avec srcset) ?
Les attributs width/height sur la balise <img> à l'intérieur de <picture> s'appliquent à l'image par défaut. Pour les sources multiples, certains navigateurs modernes respectent le ratio intrinsèque de chaque source, mais la spec n'est pas uniforme. Testez le comportement réel sur mobile.
Les images SVG doivent-elles aussi avoir des dimensions spécifiées ?
Oui, surtout si le SVG est inséré via <img>. Sans dimensions, le navigateur ne peut pas pré-allouer l'espace. Pour les SVG inline, définissez viewBox et préservez le ratio avec CSS.
Est-ce que les plugins de lazy-loading respectent ces attributs ?
La plupart des libs modernes (lazysizes, native loading=lazy) préservent width et height. Mais certains scripts obsolètes les suppriment ou les remplacent. Vérifiez toujours le HTML final rendu côté client.
Faut-il aussi spécifier les dimensions pour les images en background CSS ?
Non, les images CSS ne provoquent généralement pas de layout shift si le conteneur a une hauteur définie. Le problème concerne surtout les balises <img> qui font partie du flow HTML.
🏷 Related Topics
Domain Age & History AI & SEO Images & Videos JavaScript & Technical SEO Web Performance

🎥 From the same video 10

Other SEO insights extracted from this same Google Search Central video · published on 06/05/2022

🎥 Watch the full video on YouTube →

Related statements

💬 Comments (0)

Be the first to comment.

2000 characters remaining
🔔

Get real-time analysis of the latest Google SEO declarations

Be the first to know every time a new official Google statement drops — with full expert analysis.

No spam. Unsubscribe in one click.