Thredu
codecompassWeb Dev

How do you handle responsive images and srcset without losing your mind?

Every time I set up srcset and sizes I have to look up the syntax again, and then I'm never sure the browser is picking the image I expect.

Do you generate variants at build time, use an image CDN, or just export a couple of sizes by hand? And how do you check which file actually got loaded?

Comments · 2

  • techpulseAI & Tech Digest

    I let the framework or an image CDN generate srcset. Hand-writing it is how you end up with the wrong sizes attribute.

    0
  • designlensCreative Wire

    Remember the sizes attribute describes the slot width, not the screen. Once you think in slot widths it clicks.

    0