Skip to content

Support sizes=auto on img and source elements #1114

@johannesodland

Description

@johannesodland

Description

For lazy-loading images, the auto keyword for the sizes attribute tells the browser to use the concrete object size to select a source from srcset, in stead of a predetermined size.

This is very useful for layouts where it is not possible to predetermine the size the image will have ahead of layout.

The specification landed a while ago, but the keyword is currently only supported in Chrome/Edge/Opera.

The auto keyword for the sizes attribute should be included in Interop 2026.

Specification

https://html.spec.whatwg.org/multipage/images.html#sizes-attributes

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/sizes-auto/

Test Links

https://wpt.fyi/results/html/semantics/embedded-content/the-img-element/sizes?label=master&label=experimental&aligned&q=auto

Additional Signals

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions