HTML imagesizes Attribute
The imagesizes attribute is used with imagesrcset on a preload <link>, and works like sizes on an <img>.
Description
The imagesizes attribute of the <link> element tells the browser how wide the preloaded image will be displayed, in the same format as the sizes attribute of <img>. It is used together with imagesrcset.
They are used on a <link> element with rel="preload" and as="image", so that a responsive image can be preloaded: the browser uses the same rules as for an <img> with srcset and sizes to pick the candidate it will actually need, instead of preloading a single, possibly wrong, file.
Syntax
<link rel="preload" as="image" imagesrcset="..." imagesizes="(media-condition) width, width">
Values
- source size listA comma-separated list of media conditions and lengths, for example
(max-width: 600px) 100vw, 50vw.
Applies To
Example
Browser Support
The following information will show you the current browser support for the HTML imagesizes attribute. Hover over a browser icon to see the version that first introduced support for this HTML attribute.
Desktop





Tablets & Mobile





