Skip to content

Support for background image-set() #156

Closed

Description

@fellyph

Description

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.

Specification

https://drafts.csswg.org/css-images-4/#funcdef-image-set

Tests

No response

Activity

  1. added this to the milestone on Sep 27, 2022
  2. atjn commented on Sep 27, 2022

    @atjn
    Contributor

    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).

  3. atjn commented on Sep 27, 2022

    @atjn
    Contributor

    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.

  4. atjn commented on Sep 27, 2022

    @atjn
    Contributor

    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.

  5. foolip commented on Sep 27, 2022

    @foolip
    Member

    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?

  6. atjn commented on Sep 27, 2022

    @atjn
    Contributor

    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 😅

  7. fellyph commented on Sep 27, 2022

    @fellyph
    Author

    It is fine, I can also add comments on the issue #144

  8. foolip commented on Sep 27, 2022

    @foolip
    Member

    Great, thanks for understanding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    focus-area-proposal

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions