QuizNot attempted
Responsive images
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
<img src="m.jpg" srcset="s.jpg 480w, m.jpg 960w, l.jpg 1600w" sizes="(max-width: 600px) 100vw, 50vw" alt="…">
srcsetlists candidate files with their intrinsic widths andsizessays how wide the image will render, so the browser picks the smallest adequate file for the viewport and pixel density.- Not max-width: 100%: it only scales the big download down visually.
- Not loading=lazy: it defers the request but still fetches the big file.
- Not hiding with a media query: a hidden
<img>is usually still downloaded. <picture>+<source media>is for art direction (different crops).