How to size responsive icon illustrations in a card grid
Answer in brief
Use width descriptors when the image slot changes with the layout. Describe the slot with sizes so the browser can estimate the required resource before layout completes.
Match the card breakpoint
Suppose artwork occupies 80 CSS pixels below 600 pixels and 144 above it. Give sizes the value "(max-width: 599px) 80px, 144px". Export candidates such as 80w, 144w and 288w with matching intrinsic widths.
Account for card padding
A card that spans 320 pixels may have 16 pixels of padding at each side. Its full-width illustration then has a 288-pixel slot. Measure the image element itself in the layout inspector before copying the grid column width into sizes. Excess estimates can make a dense gallery unnecessarily expensive.
Sources
- [1] HTML Standard — WHATWG, accessed November 23, 2026
Frequently asked questions
Why does a tiny card request a large file?
Inspect the sizes value and device pixel ratio together. A wide default slot or a high-density display can each increase the requested width.