v147 · html · covered on mdn
Auto Sizes for Lazy Loaded Images with Srcset
Setting sizes="auto" on a lazy-loaded <img> element with a srcset lets the browser compute the correct sizes value from the element's rendered layout width — eliminating manual media-query breakpoints in the sizes attribute and ensuring the right image is always selected.
this feature is documented on MDN
MDN: HTMLImageElement.sizes
MDN's HTMLImageElement.sizes reference covers the auto keyword, its interaction with loading="lazy" and srcset, browser compatibility, and the underlying HTML Living Standard. gendn doesn't duplicate that here.
quick reference
| HTML | <img sizes="auto" loading="lazy" srcset="…"> |
|---|---|
| Requires | loading="lazy" and a srcset with width descriptors (w) |
| Effect | Browser uses the element's rendered layout width to select a source from srcset, rather than the default 100vw assumption |
| Shipped in | Chrome 147 (Enabled by default) |
| Standards position (Firefox) | Shipped |
| Standards position (Safari) | Shipped |
| Spec | HTML Living Standard — sizes attributes |
| ChromeStatus | 5191555708616704 — Auto Sizes for Lazy Loaded Images with Srcset |