Serve Responsive Images with Less Page Weight
8 steps · about 3 h 15 min · Intermediate
- Understand responsive image problems (guide, MDN Web Docs, 30 min)
Separate resolution switching from art direction and choose the right HTML mechanism for each.
- Use the img element completely (reference, MDN Web Docs, 25 min)
Review intrinsic dimensions, decoding, loading, fetch priority and accessibility attributes together.
- Offer image candidates with srcset (reference, MDN Web Docs, 20 min)
Let the browser select an appropriate resource by width or pixel-density descriptor.
- Describe layout slots with sizes (reference, MDN Web Docs, 20 min)
Tell the browser how wide an image will render before CSS and the full page have loaded.
- Use picture for art direction and formats (reference, MDN Web Docs, 25 min)
Supply alternate crops or modern formats while retaining a dependable img fallback.
- Prioritize the likely largest image (guide, web.dev, 30 min)
Avoid delaying the image that becomes Largest Contentful Paint through unsuitable loading choices.
- Lazy-load only off-screen images (guide, web.dev, 20 min)
Defer below-the-fold downloads without accidentally delaying prominent content.
- Reserve image space to prevent layout shifts (guide, web.dev, 25 min)
Use intrinsic width and height or aspect ratios so later image decoding does not move surrounding content.