Lea Verou 12/10/2020

The -​-var: ; hack to toggle multiple values with one custom property

Read Original

This article explains a clever CSS hack using custom properties. By setting a property like `--foo: ;` (a single space), you can use `var(--foo, fallback-value)` to conditionally append or remove multiple style values (like gradients, borders, shadows) across different properties and rules, acting as a single-clause conditional.

The -​-var: ; hack to toggle multiple values with one custom property

commentaires

No comments yet

Be the first to share your thoughts!

Browser Extension

Get instant access to AllDevBlogs from your browser

Top of the Week

No top articles yet