web-platform-tests / interop

web-platform-tests Interop project
https://wpt.fyi/interop
284 stars 28 forks source link

CSS image() function #744

Open BearCooder opened 21 hours ago

BearCooder commented 21 hours ago

Description

Was proposed last year too by @jsnkuhn

The image() function allows an author to:

  • use media fragments to clip out a portion of an image
  • use a solid color as an image
  • fallback to a solid-color image, when the image at the specified url can’t be downloaded or decoded
  • automatically respect the image orientation specified in the image’s metadata

spec fixes many long standing issues with CSS images:

FYI: the above are all from images-4 but the CSSWG is already looking at expanding image() in images-5 for things like background video (https://github.com/w3c/csswg-drafts/issues/6732) and @image-manipulation (https://github.com/w3c/csswg-drafts/issues/6807)

more detailed explainer: https://12daysofweb.dev/2022/css-image/

Tests

https://wpt.fyi/results/?label=master&label=experimental&aligned&view=subtest&q=css-image-fallbacks

Standards Positions

Mozilla: https://github.com/mozilla/standards-positions/issues/856

Browser bug reports

Polls & Surveys

https://2023.stateofcss.com/en-US/features/

are aware: 2876 have used: 1418

img2 img

Workarounds

There is a postCSS plugin for image() https://github.com/valtlai/postcss-color-image

Specification

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

Additional Signals

No response

jsnkuhn commented 2 hours ago

just opened a standards position issue for webkit: https://github.com/WebKit/standards-positions/issues/402