Unsized images are <img> and <video> elements that don't declare an explicit width and height (or an equivalent CSS aspect-ratio). Without those values the browser cannot reserve space for the media before it downloads — so when the file finally arrives, every element below it is pushed down. That sudden push is the single largest cause of bad Cumulative Layout Shift (CLS).
width and height to every <img> and <video> tag — even when CSS resizes them.aspect-ratio reserves space proportionally for fluid responsive images.width/height aspect-ratio behaviour has been universal in evergreen browsers since 2019 — there is no compatibility cost to adding them.Think of it like setting a place at a dinner table before the guest arrives. Once you reserve the chair, no one else is shoved sideways when they sit down. width and height are the reservation — the browser knows exactly how much room each image needs, even before a single pixel has loaded.
Unsized media damages user experience and rankings in five concrete ways:
When the browser parses an <img>tag without explicit dimensions, it reserves a content box of effectively zero height. Surrounding elements collapse upward to fill that empty space. Then, when the image file finally downloads and decodes, the browser inserts the real dimensions — pushing every element below the image down by the image's full height.
With width and height attributes (or aspect-ratio CSS), the browser computes an intrinsic aspect ratio at parse time and reserves a correctly-sized box before any pixel downloads. The image fades into a space that already exists.
<!-- Bad: no dimensions, browser reserves 0 height -->
<img src="/hero.jpg" alt="Hero">
<!-- Good: dimensions declared, browser reserves a 16:9 box -->
<img src="/hero.jpg" alt="Hero" width="1600" height="900">
<!-- Even when CSS resizes it, the aspect ratio is preserved -->
<style>
img { width: 100%; height: auto; }
</style>False. Since 2019, every evergreen browser uses the width and height attributes only to compute an aspect ratio when CSS overrides the rendered size. With height: auto in your stylesheet, the image still resizes fluidly — the attributes only tell the browser how much space to reserve in advance. Always include them.
Audit tooling flags any image-shaped element that lacks explicit dimensions. The most reliable ways to surface them:
The most direct fix. Use the image's intrinsic pixel dimensions — they are used only for ratio calculation, not final render size.
<img src="/post-cover.jpg" alt="" width="1200" height="630">For art-directed responsive images that change shape across breakpoints, set aspect-ratio on the image or its container. The browser reserves the proportional space regardless of viewport width.
img.cover {
aspect-ratio: 16 / 9;
width: 100%;
height: auto;
}The audit covers any media element. Videos benefit from the same attributes — and the same browser support story.
<video src="/promo.mp4" width="1280" height="720" controls></video>CSS background-image doesn't carry intrinsic dimensions. Reserve space with explicit height, padding-aspect-ratio, or the aspect-ratio property on the wrapping element.
Next.js <Image>, Nuxt <NuxtImg>, Astro <Image>, and similar components require width and height (or a fill mode that reserves space) by design. Switching to them eliminates an entire class of regression.
Most CMSs store image dimensions when uploaded but only emit them in the rendered HTML if the theme template references them. Audit your image partial / template and ensure both attributes ship.
Add an ESLint rule (e.g., jsx-a11y-style image checks or a custom rule) so missing width/height fails the build. This prevents the regression that initially caused the audit failure.
If you set width: 100% without height: auto, the browser still uses the attributes for ratio — but a hard height: 100px rule will override it and re-introduce shifts. Pair fluid widths with auto heights.
/* Good — preserves the declared aspect ratio */
img { width: 100%; height: auto; }
/* Bad — forces a fixed height that may not match the file */
img { width: 100%; height: 200px; }What's happening: Editors paste images from external sources without specifying size, and the CMS rich-text field stores the bare <img>.
Fix: Run a server-side post-processing step that reads each image's intrinsic dimensions and injects width/height before the HTML reaches the browser. Most static-site generators expose a hook for this.
What's happening: A carousel, lightbox, or related-posts widget injects <img> elements at runtime without dimensions, causing shifts after the document has already rendered.
Fix: Ensure the JS template includes width and height on every injected image, or wrap injection points in a container with a fixed aspect-ratio.
What's happening: Developers add srcset or <picture> for responsive images and assume they replace width/height. They don't — the attributes still belong on the fallback <img>.
Fix: Always set width and height on the <img> inside <picture>. The browser uses those values for ratio regardless of which source wins.
What's happening: Even with loading="lazy", an image without dimensions reserves zero space. When the user scrolls and it loads, content below it shifts inside the active session window.
Fix: Lazy-loading does not replace dimensions — keep both. loading="lazy" defers the download; width/height reserves the space.
Several techniques reserve space for media. The right one depends on whether the image needs to be fluid, fixed, or art-directed.
| Technique | Best For | CLS Risk | Notes |
|---|---|---|---|
width + height attributes | Almost every image | None when paired with height: auto | The default fix recommended by web.dev. |
CSS aspect-ratio | Fluid images that change ratio across breakpoints | None | Pair with width: 100%; works on containers too. |
| Padding-bottom hack | Legacy support before aspect-ratio shipped | None | Still works; aspect-ratio is cleaner in modern code. |
| No dimensions | Never recommended | High — common cause of CLS > 0.25 | Browser reserves zero space until image arrives. |
Fixed pixel width + height in CSS | Icons, small UI sprites | None | Fine when the image will never resize fluidly. |
It means at least one <img> or <video> tag on the page is missing both the width and height attributes (and has no equivalent aspect-ratio CSS). Audits flag this because the browser cannot reserve space for the element before it loads, which causes layout shift.
Yes. Modern browsers use the attributes only for the aspect-ratio calculation when CSS overrides the rendered size. Add the intrinsic pixel dimensions to the HTML and use width: 100%; height: auto in CSS — the image will scale fluidly and the space will still be reserved.
No. Provided your CSS includes height: auto (or equivalent), the rendered size is determined by CSS while the attributes are used purely to reserve space. Browser support has been universal since 2019.
CSS background images don't affect layout, but the element they live on still needs reserved space. Set an explicit height, padding-bottom ratio, or aspect-ratioon the container so it doesn't collapse before the background loads.
No. <picture> and srcset select which file to load — they don't reserve space. Keep width and height on the inner <img> tag. The browser uses them for the ratio regardless of which source wins.
Indirectly but meaningfully. AI answer engines and Google AI Overviews tend to cite pages that already rank well in traditional search. Unsized images push CLS above Google's 0.1 threshold, which weakens Page Experience and reduces the odds of the page being chosen as a citation.
Rarely. The only legitimate exception is when an image's intrinsic dimensions genuinely cannot be known ahead of time (e.g., user-uploaded content rendered with no preprocessing). Even then, the right answer is to add a server-side step that detects the dimensions before the HTML ships — not to leave the image unsized.
Unsized images are the easiest-to-fix performance regression in modern web development. Two attributes, no architectural changes, no CSS overhaul — just width and height on every media element. The payoff is a CLS score that passes Core Web Vitals, fewer misclicks on mobile, and a layout that feels stable from the first paint.
Run a Greadme deep scan to see exactly which images on each page are missing dimensions, then fix them in order of viewport impact.