HTML srcset 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 srcset attribute specifies one or more strings separated by commas, indicating possible image sources for the user agent to use.
If no descriptor is specified, the source is assigned the default descriptor of 1x.
Standard Syntax
<element srcset="URL-list">
Browser Support
Status
Applies to:
The srcset attribute can be used on the following element:
Attribute Values
Value | Description |
---|---|
URL | Source url to an image |
Optionally |
whitespace followed by one of:
|