News for hackers. Stuff that matters.
Re:Responsive images by chiefalchemist on Saturday June 12, 2021 @11:57AM (#27485308)
You might be correct. Regardless, the choice is always on the browser, as it should be. It's the only one who knows the screen res, how wide and tall, the markup, etc. With all that it picks.

Again, that article I shared does a great job of explaining. I'll re-read to find out about 1x, 2x, etc.

Re:Responsive images by superfad on Saturday June 12, 2021 @01:15PM (#27485884)
The only time the sizes attribute is not needed when using srcset is when the rendered size of the image is fixed.

One example would be a logo that is less than 320px wide (so it fits even on mobile). In that case you can add x descriptors to give a higher quality logo on retina screens. e.g.

<img src="logo.jpg" alt="Logo" srcset="logo.jpg, logo-2X.jpg 2x">

Alternatively use an svg :)

But if the image depends on the viewport width then 'srcset' (without x descriptors but with w descriptors) and in combination with 'sizes' is the way to go.