Optimizing images with the HTML tag
1–10 of 52 posts
Re: Optimizing images with the HTML <picture> tag
#2Re: Optimizing images with the HTML <picture> tag
#3Re: Optimizing images with the HTML <picture> tag
#4Likely not. Chrome is actually deprecating JPEG XL, the news broke yesterday.
Re: Optimizing images with the HTML <picture> tag
#5Isn't it the purpose of the "Accept" HTTP header? For example the last version of Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,/;q=0.8" when fetching a page.
Re: Optimizing images with the HTML <picture> tag
#6Re: Optimizing images with the HTML <picture> tag
#7> I don’t think there’s a perfect answer. You simply cannot predict with 100% certainty what the browser would choose. But you can get a good approximation by parsing the User-Agent header Isn't it the purpose of the "Accept" HTTP header? For example the last version of Firefox sends "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp, / ;q=0.8" when fetching a page.
Re: Optimizing images with the HTML <picture> tag
#8MDN says that img tag purpose is not just to serve as a fallback, but also to specify size “and other attributes”. Does it also include alt attribute? This is important. Can someone confirm that?
Re: Optimizing images with the HTML <picture> tag
#9The title lost the essential "picture" tag part of it, probably to html sanitization
Re: Optimizing images with the HTML <picture> tag
#10MDN says that img tag purpose is not just to serve as a fallback, but also to specify size “and other attributes”. Does it also include alt attribute? This is important. Can someone confirm that?
The final tag also specifies common attributes like width, height and alt text. Those attributes will apply regardless of which source the browser chooses!
The official spec for the picture element is here https://html.spec.whatwg.org/multipage/embedded-content.html... and it says The picture element is a container which provides multiple sources to its contained img element to allow authors to declaratively control or give hints to the user agent about which image resource to use, based on the screen pixel density, viewport size, image format, and other factors. It represents its children.
So I read that as the alt text (as well as other attributes other than the actual src url) come from the img tag