UPDATE: The code snippet has been updated to use --custom
instead of --
. When Ire originally tweeted this --
was a valid name for a custom property. This is no longer the case.
As tweeted by Ire Aderinokun:
@supports (color: var(--custom)) {
/* has support */
}
Not too surprising if you’ve used Feature Queries before, but what does surprise me is that you can make it work by only passing the prefix of CSS Custom Properties (e.g. --custom
) into the var()
function.
See the Pen
Supports CSS Variables by Bramus (@bramus)
on CodePen.
Consider donating.
I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!
Another option: @supports (–a: 0).
Ooh, nice! 🙂