The --var: ; hack to toggle multiple values with one custom property
Read OriginalThis 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.
0 Comments
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
1
ServiceNow and Microsoft Copilot
Marius Sandbu
•
1 votes
2
The Learning Loop and LLMs
Martin Fowler
•
1 votes