Worked example
Required source widths (px): 640, 600
Inputs
- Rendered slot widths (CSS px): 320,600
- Device pixel ratios for those slots: 2,1
- Available source widths (image px): 400,640,800
For each slot, choose the smallest supplied source width at least as large as slot × pixel ratio.
Use the units shown.
Round up each CSS slot width × its device pixel ratio.
Pick the smallest available source at least that wide; otherwise show the missing minimum.
For each slot, choose the smallest supplied source width at least as large as slot × pixel ratio. Report a missing source when none fits. This deterministic planning rule does not reproduce every browser image-selection decision; it ignores art direction and network preferences.
MDN: responsive images and pixel density ↗Required source widths (px): 640, 600
Required source widths (px): 150, 500