HTML Attributes
HTML srcset attribute
Lists image URLs with width or pixel-density descriptors. The browser selects a candidate based on the display environment; use sizes with width descriptors and provide an img fallback. Applicable elements include: <img>, <source>. Check each element’s value rules. Example uses illustrative URLs or local assets; provide the corresponding files or application endpoints when running it.
Formal Syntax & Structure
html syntaxhtml
srcset="photo.jpg 1x, photo-2x.jpg 2x"Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| srcset | image candidate list | Lists image URLs with width or pixel-density descriptors. The browser selects a candidate based on the display environment; use sizes with width descriptors and provide an img fallback. |
Working Example
Example Snippethtml
<img src="photo.jpg" srcset="photo.jpg 1x, photo-2x.jpg 2x" alt="Forest path">Browser Compatibility
Minimum supported versions across modern rendering engines
Blink (modern)
Chrome
34
Yes
EdgeHTML / Blink
Edge
12
Yes
Gecko
Firefox
38
Yes
WebKit
Safari
8
Yes
Support for srcset on img; individual descriptors and source contexts vary. This is retained historical source evidence, not a new browser test.
HTML Living Standard