This feature allows specifying a width and height on <source> elements that are used in <picture>, which allows the image to compute an aspect ratio from these attributes, e.g.: <picture> <source srcset="image.jpg" width="640" height="480"> <img style="width: 100%; height: auto;"> </picture> In this example, the width of the image will adjust to the size of its container and the height will follow the aspect ratio, even before the image is loaded (avoiding a content shift).
Matches similar behavior for non-<picture> images, <canvas> and <video>
Specification being incubated in a Community Group
Status in Chromium
Enabled by default
Consensus & Standardization
Last updated on 2021-10-18