-
Notifications
You must be signed in to change notification settings - Fork 237
Add CSS filter() function #3718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes web-platform-dx#3378 This has been supported since Safari 9, see https://caniuse.com/css-filter-function. MDN docs or compat data are not currently available, but will be linked once they are.
bb52dfc to
42b5da1
Compare
|
@captainbrosset @foolip Could you please take a look? |
@nt1m do you know if there's already a PR opened on BCD to add the required keys for this feature? If there isn't one, would you or someone on your end be able to create one? |
features/filter-function.yml
Outdated
| @@ -0,0 +1,5 @@ | |||
| name: filter() | |||
| description: The `filter()` CSS function applies one or more graphic effects to an CSS image and returns a new image. You can use filter functions, such as `blur()` and `drop-shadow()`, alone or combined to produce different effects. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| description: The `filter()` CSS function applies one or more graphic effects to an CSS image and returns a new image. You can use filter functions, such as `blur()` and `drop-shadow()`, alone or combined to produce different effects. | |
| description: The `filter()` CSS function applies one or more graphic effects to a CSS image and returns a new image. You can use filter functions, such as `blur()` and `drop-shadow()`, alone or combined to produce different effects. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name and description fields are very similar to the ones in the filter.yml feature. It's good for consistency, but might be a bit confusing to web developers. I'm not sure I'd be able to really tell which feature does what if I didn't already know about them, just by reading these fields.
I think what's missing for me is an example of where you use each feature. So maybe:
-
In
filter.yml:The
filterCSS property applies one or more graphic effects to an element. You can use functions, such asblur()anddrop-shadow(), alone or combined to produce different effects. For example:filter: blur(2px). -
In
filter-function.yml:The
filter()CSS function applies one or more graphic effects to a CSS image, such as a background image. You can use functions, such asblur()anddrop-shadow(), alone or combined to produce different effects. For example:background: filter(url(image.png), blur(2px)).
Updated description to clarify usage of filter() with background images and provided an example.
|
I created a BCD PR here: mdn/browser-compat-data#28916 . I was reluctant to create one until some MDN docs were written, but it looks like you can just create one independently! |
Fixes #3378
This has been supported since Safari 9, see https://caniuse.com/css-filter-function.
MDN docs or compat data are not currently available, but will be linked once they are.