FlashcardNot attempted
srcset w vs x descriptors, and <picture>
Recall it before you reveal
When do you use srcset with x descriptors, with w descriptors, and <picture>?
Space to reveal
Show answer & explanation
- x descriptors (
img.jpg 1x, img@2x.jpg 2x): fixed-size images (icons, logos). The browser matches the device pixel ratio; nosizesneeded. - w descriptors (
small.jpg 480w, large.jpg 1200w) + sizes: fluid images. The browser computes the layout width fromsizes, multiplies by the DPR and picks the closest file.sizesis mandatory, or the browser assumes 100vw. - `<picture>` + `<source media>`: art direction (a different crop per breakpoint). The first matching source wins;
<img>is the fallback.