Skip to content

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.

  1. Decode and paint into the reserved box
  2. Download (respecting loading="lazy" / fetchpriority)
  3. Multiply by the device pixel ratio and pick the best srcset candidate
  4. Evaluate sizes to predict the rendered width (CSS isn't loaded yet)
  5. Reserve space from the width/height aspect ratio (prevents layout shift)
Show answer & explanation

Correct order:

  1. Reserve space from the width/height aspect ratio (prevents layout shift)
  2. Evaluate sizes to predict the rendered width (CSS isn't loaded yet)
  3. Multiply by the device pixel ratio and pick the best srcset candidate
  4. Download (respecting loading="lazy" / fetchpriority)
  5. 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.