You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
image-set() property, is only supported by 74% of the browsers, this feature can be a good performance improvement for the web, because actually background images are heavily used by CMS and page builders and some case the images included only accept one size. There are other solutions to solve it but image-set could simplify this implementation.
Rationale
Some CMS, such as WordPress, has components to display a hero image, and some scenarios when is included a parallax effect or some other reason. the image is included via background image, and by most of the browser only accepts one image size for all screens, the ideal scenario is to load a size for each size of screen and css function image-set() can be a alternative for it.
This is not just useful for different sized images, it can also be used to serve different image formats, depending on browser support. This is a very useful feature right now because of the varying support for WebP (mostly solved now), AVIF (currently problematic), and JPEG XL (upcoming problem).
IMO image-set() is a great candidate for web compat 2023 because of the very fragmented support for its sub-features. If you want to use it in production right now, you have to write and test three different versions, one for each major browser engine. It would be very helpful if this could be simplified.
Another compat issue that could be adressed, is compatibility between the <picture> element and image-set().
<picture> supports the w/h keys to denote resolution. This is more universally useful than using the x key. Unfortunately, w/h has not yet been added to the image-set spec. This means that image minification pipelines have to treat images differently, depending on whether they will be imported with html or css. It would greatly simplify these tools if it was possible to use a single pipeline for all images.
The spec already mentions that this should be added in ISSUE 2.
I'd say you can close this as a duplicate of #144, since that one is more detailed and covers more use cases. Too bad I added my comments to the duplicate 😅
Activity
atjn commentedon Sep 27, 2022
This is not just useful for different sized images, it can also be used to serve different image formats, depending on browser support. This is a very useful feature right now because of the varying support for WebP (mostly solved now), AVIF (currently problematic), and JPEG XL (upcoming problem).
atjn commentedon Sep 27, 2022
IMO
image-set()is a great candidate for web compat 2023 because of the very fragmented support for its sub-features. If you want to use it in production right now, you have to write and test three different versions, one for each major browser engine. It would be very helpful if this could be simplified.atjn commentedon Sep 27, 2022
Another compat issue that could be adressed, is compatibility between the
<picture>element andimage-set().<picture>supports thew/hkeys to denote resolution. This is more universally useful than using thexkey. Unfortunately,w/hhas not yet been added to theimage-setspec. This means that image minification pipelines have to treat images differently, depending on whether they will be imported withhtmlorcss. It would greatly simplify these tools if it was possible to use a single pipeline for all images.The spec already mentions that this should be added in
ISSUE 2.foolip commentedon Sep 27, 2022
I've only skimmed the issues, but is this a duplicate of #144? If so, could you (@jsnkuhn and @fellyph) work together on a single proposal?
atjn commentedon Sep 27, 2022
I'd say you can close this as a duplicate of #144, since that one is more detailed and covers more use cases. Too bad I added my comments to the duplicate 😅
fellyph commentedon Sep 27, 2022
It is fine, I can also add comments on the issue #144
foolip commentedon Sep 27, 2022
Great, thanks for understanding!