Images without width and height attributes can cause layout shifts, negatively impacting Core Web Vitals and SEO rankings.
By Seoxpert Editorial · Published
When images lack explicit width and height attributes, browsers cannot allocate the correct space before the image loads, causing content to shift as images appear. This layout shift is measured by the Cumulative Layout Shift (CLS) metric, a key part of Google's Core Web Vitals, which directly influences search rankings and user experience.
Unresolved, this issue can lead to poor user experience and lower rankings in Google Search due to high CLS scores.
An automated crawler scans the HTML for <img> tags missing both width and height attributes.
Problem: Missing width and height
<img src="photo.jpg" alt="">Fix: Add width and height attributes
<img src="photo.jpg" width="800" height="600" alt="">Alternative Fix: Use aspect-ratio in CSS
img {
aspect-ratio: 4 / 3;
width: 100%;
height: auto;
}Without these attributes, browsers can't reserve space for images, so content moves when images load, causing layout shifts.
Yes, CSS aspect-ratio can reserve space for images, but explicit width and height attributes are still recommended for compatibility.
Yes, even responsive images should have width and height attributes that match their intrinsic size to prevent layout shifts.
Ensure you set width and height attributes or use CSS aspect-ratio when inserting images dynamically to avoid layout shifts.
Run a scan to see if Images Missing Width and Height Attributes (Layout Shift Risk) affects your pages.
Scan my website →