Favorites

HTML imagesizes Attribute

imagesizes
HTML AttributeThis attribute is supported by all modern browsers.
Updated 22nd November 2026

The imagesizes attribute is used with imagesrcset on a preload <link>, and works like sizes on an <img>.

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.

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

<link rel="preload" as="image"
href="hero-800.jpg"
imagesrcset="hero-400.jpg 400w, hero-800.jpg 800w, hero-1600.jpg 1600w"
imagesizes="100vw">
Open in editor

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.

This attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported

Looks like you're using an ad blocker, and that's fine! Ads help keep CSS Portal's generators and references free, so if the site's useful to you, visit our Support page to see other ways to help.