-
@zachleat Currently reading your article, I'm really surprised by "The 100% in max-width refers to the image’s dimensions". IMHO, these 100% refer to the container width.
-
@zachleat Also, in your "srcset and width: 100%" section, images have a
srcset-wbut nosizes, so the browser understands it needs an image as large as the viewport, and downloads the 400px images for the 4 examples. -
@zachleat In the fourth image in section "srcset and max-width: 100%", the
sizes="300px"makes the browser download the 400px image (on a 1dppx screen), andwidth="200"renders it at 200px wide. I don't understand the idea to add awidth: autoto prevent this, as it is "normal". -
@zachleat BTW, to answer your question at the end, I do use the dimensions of the pristine image for the
widthandheightattributes. It's mainly to get the ratio right, and prevent enlarging small images. Actually, my build gets the dimensions: github.com/nhoizey/nicolas-hoizey.com/blob/main/src/_11ty/images-responsiver-config.js#L23-L32