10 years ago today, I shared this idea for how WordPress could ship a default sizes
attribute for responsive images.
For content images, we may not know the actual width of the image in a layout, but we might be able to assume that the maximum width of the image is the width of the original image selected (i.e., the one referenced by the
src
attribute) and build asizes
list accordingly. For example, if the original image that was chosen is 600px wide, we might be able to safely tell the browser that the image should never be larger than 600px wide. Or to put it in terms of asizes
attribute list, it would look like this:
sizes="(min-width: 600px) 600px, 100vw"
Looking back at this thread a decade later, I’m so grateful for the impact getting involved in that scrappy little project has had on my life. Even though I had a mistake in the original idea I shared (the actual default should have been sizes="(min-width: 600px) 100vw, 600px"
) it’s a good example of one of the most important lessons I’ve learned working in open source— working and learning in the open is a powerful way to sharpen your thinking and build stronger products.
Leave a Reply