3 ms·
Isn't the problem more that the browser can't be given multiple sources and types and allow it to chose what it believes is best? How would this look
by cbr 12y ago
Isn't the problem more that the browser can't be given
multiple sources and types and allow it to chose what
it believes is best?
How would this look? If you simply did:
<img src-options="image.jpg
image.webp">
There's no way for the browser to know which one it wants without downloading all of them, because extensions aren't special. But I guess we could extend srcset to let you specify content type:
<img srcset="medium.jpg 1000w image/jpeg,
medium.webp 1000w image/webp,
large.jpg 2000w image/jpeg,
large.webp 2000w image/webp">
- SoftwareMaven 12y agoYou are very close to CSS media queries there. Perhaps there is a solution in media queries.
- larzang 12y agoYou just described the new "picture" element. It's an element with one or more "source" child elements which each have a media query and a uri, as well as an img child element to use as a fallback for non-supporting browsers. Browser support isn't really there yet but it's coming and since it has a built-in fallback you can use it now without requiring JS workarounds.
- acdha 12y agoIt's under consideration in IE so now would be a good time to vote for it since it's so much cleaner than srcset: https://wpdev.uservoice.com/forums/257854-internet-explorer-platform/suggestions/6261271-picture-element https://wpdev.uservoice.com/forums/257854-internet-explorer-...