Marcus Andrey Study
Ler em português Library

Framework · Imagery · 3 min read

Responsive image checklist

Six things every product image needs before it ships (widths, sizes, crops, dimensions, loading priority and alt text), so each screen gets a sharp file that is no bigger than it needs and the page doesn't jump.

1Widths

A few standard file widths, made from one master.

srcset: 480, 960, 1600
2Sizes

How wide the image is on screen at each breakpoint.

100vw on phones, 40rem
3Crop

A new crop only where the subject would be lost.

picture, or a focal point
4Shape

Width and height on every image, so nothing jumps.

width="1600" height="900"
5Priority

The first screen loads first; the rest waits.

fetchpriority, loading="lazy"
6Alt text

Written by someone who knows why the image is there.

On the img, not the source
Six decisions per image; numbers 1 to 3 pick the file, 4 to 6 make it load well and read well.

Use it when

  • You hand off a new page or component with photos, and developers ask "which sizes?"
  • A page feels slow on phones, or jumps while it loads.
  • A hero crop that works on desktop loses its subject on a phone.

How to use it

  1. Agree the standard widths. Pick a small set of file widths the team generates for every photo, for example 480, 960 and 1600, and make them automatically from one master. Output: the srcset list for every image.
  2. Write the width on screen per breakpoint. For each image, say how wide it is at each breakpoint: full width on phones, 40rem on desktop, and so on. That becomes sizes. Output: a sizes value that matches the layout.
  3. Decide crop or focal point. If the subject would be lost or cut on a phone, give the phone its own crop with <picture>. Otherwise keep one crop and mark the focal point. Output: crops and their breakpoint, or one focal point.
  4. Give every image its shape. Every img gets width and height (or a CSS aspect-ratio), so the browser keeps the space before the file arrives. Output: no layout shift from images.
  5. Set the loading priority. The image in the first screen loads first, never lazy, and gets fetchpriority="high" if it's the largest element. Everything further down gets loading="lazy". Output: one priority line per image.
  6. Write the alt text. Someone who knows why the image is there writes it. Inside <picture>, it goes on the img. Output: alt text, or alt="" for a decorative image.

Worked example

The bakery ordering app adds a seasonal hero and a grid of product cards. The handoff for the hero: widths 480, 960, 1600; sizes="(max-width: 560px) 100vw, 40rem"; a tall phone crop below 560px because the wide shot turns the loaf into a crumb; width="1600" height="900"; loads first with fetchpriority="high"; alt "A round seeded sourdough loaf on a wooden board." The product cards: the same widths, sizes="(max-width: 560px) 50vw, 15rem", one crop with the focal point on the bread, width="480" height="320", loading="lazy", alt text per product. The developer didn't have to guess anything.

Watch out for

  • One huge file for every screen. It looks fine on your monitor and costs every phone user several times what it should.
  • A sizes that doesn't match the layout. The browser trusts it and downloads the wrong file. Update it when the layout changes.
  • Lazy-loading the hero. It always delays the largest thing on screen. Lazy loading is for images below the first screen.
  • Art direction everywhere. A separate crop for every image is work nobody needs. Use it only where the subject would be lost.

Template

Copy one block per image into the handoff.

Image: ...
Widths (srcset): 480, 960, 1600   (team standard)
Width on screen (sizes): phone ... / tablet ... / desktop ...
Crop: one crop, focal point at ...   OR   phone crop below ...px: ...
Dimensions: width ... height ...   (or aspect-ratio ...)
Priority: first screen, fetchpriority="high"   OR   loading="lazy"
Format and quality: ...
Alt text: "..."   (or alt="" if decorative)
Source
srcset, sizes and <picture>: the HTML Living Standard (WHATWG), explained in MDN. Loading priority and layout shift: web.dev (Optimize LCP, Optimize CLS)

"See on Amazon" links are affiliate links. As an Amazon Associate I earn from qualifying purchases, at no extra cost to you.

Saved only on this device.

↑ ↓ to move · Enter to open · Esc to close