OrderNot attempted
How the browser loads a responsive image
Order what happens for an <img> with width/height, srcset and sizes.
Drag the rows, or use the arrows, to put them in order from first to last.
- Decode and paint into the reserved box
- Download (respecting
loading="lazy"/fetchpriority) - Multiply by the device pixel ratio and pick the best
srcsetcandidate - Evaluate
sizesto predict the rendered width (CSS isn't loaded yet) - Reserve space from the width/height aspect ratio (prevents layout shift)
Show answer & explanation
Correct order:
- Reserve space from the width/height aspect ratio (prevents layout shift)
- Evaluate
sizesto predict the rendered width (CSS isn't loaded yet) - Multiply by the device pixel ratio and pick the best
srcsetcandidate - Download (respecting
loading="lazy"/fetchpriority) - Decode and paint into the reserved box
The preload scanner fetches images before CSS arrives, so HTML attributes drive every decision. Missing width/height causes CLS; missing sizes makes the browser assume 100vw and over-download; lazy-loading the LCP image delays LCP.