srcset and sizes
Widely available since 2019-09-27
The srcset
and sizes
attributes for <img>
elements set a list of possible sources for the image and a corresponding list of size conditions for choosing a source, to show a responsive image that fits the size of the display.
Learning resources on MDN
Browser support (view on caniuse.com)
- Chrome 38 Released on 2014-10-07
- Chrome Android 38 Released on 2014-10-08
- Edge 13 Released on 2015-11-12
- Firefox 38 Released on 2015-05-12
- Firefox for Android 38 Released on 2015-05-12
- Safari 10.1 Released on 2017-03-27
- Safari on iOS 10.3 Released on 2017-03-27
Specifications
- HTML Standard (#attr-img-srcset), from HTML Workstream (WHATWG).