HTML sizes Attribute
Example
<img srcset="demo/book.png 320w, demo/cup.png 640w, demo/desk.jpg 1200w"sizes="100vw" src="demo/image.jpg" alt="demo" width="300" height="200">
Meaning
The sizes attribute specifies One or more strings separated by commas, specifies a set of source sizes.
Each source size consists of:
- A media condition. (This must be omitted for the last item in the list.)
- A source size value. (The selected source size affects the intrinsic size of the image display size if no CSS styling is applied. If the srcset attribute is absent, or contains no values with a width descriptor, then the sizes attribute has no effect.)
Standard Syntax
<element sizes="sizes">
Browser Support
Status
Applies to:
The sizes attribute can be used on the following element:
Attribute Values
More Examples
Example
<link rel="icon" href="demo/demo-icon.png" type="image/png" sizes="16x16">