Live data from Hacker News

The end of responsive images

piccalil.li

21–25 of 25 posts

Re: The end of responsive images

#21
Key passages:

>A few weeks ago, two patches landed in Gecko and WebKit… aligning [them] with Blink in supporting a relatively recent addition to the HTML specification: support for an auto value in sizes attributes.

>[T]he central issue with srcset/sizes was one of timing: a browser makes decisions about image requests long before it has any information about the page's layout… That assumption is… still the default behavior: if there’s an img in your markup, the request it triggers will be fired off long before any information about the layout can be known

>[T]hat is, unless that image uses the loading="lazy" attribute… [which] changes that entire equation — now those images are requested at the point of user interaction, long after the browser has all the information it needs about the sizes of the rendered image.

The mdn page is https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageEl... but what the mdn examples don't include is that the auto attribute can be used in addition to a specified sizes fallback. The Piccalilli article discusses this and includes example markup.

Re: The end of responsive images

#24
post #2

I can't believe this doesn't mention Image Seam Carving. Surprise this was never built into browsers. https://trekhleb.dev/js-image-carver/

Building something like this into a browser would be a bad idea, as it's incredibly resource-intensive.

Re: The end of responsive images

#25
post #21

Key passages: > A few weeks ago, two patches landed in Gecko and WebKit… aligning [them] with Blink in supporting a relatively recent addition to the HTML specification: support for an auto value in sizes attributes. > [T]he central issue with srcset / sizes was one of timing: a browser makes decisions about image requests long before it has any information about the page's layout… That assumption is… still the defau…

Correction: the mdn is https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/... and in fact does include an example with fallback sizes. My apologies to the mdn authors – https://github.com/mdn/content/pull/43684
Post reply on HN