Post #2375690
2023-01-15 19:20 UTC
@mia@front-end.social I have been thinking about the reason why ppl decide to use `var()` to call custom properties... surprisingly, I still have no idea why.
Last time I check, fallback arg (2nd one) doesn't seem useful. And if fallback is really needed, just do like this `--css-var(fallback)`. Why we have to go all the way with vsr function?
Replies (1)
-
@mia@front-end.social 2023-01-15 20:18
@ngdangtu@tilde.zone Fallback is absolutely useful: - https://css-tricks.com/using-custom-property-stacks-to-tame-the-cascade/ - https://www.smashingmagazine.com/2019/07/css-custom-properties-cascade/ Sure, there could have been various ways to define a syntax for that - and I wasn't on the WG when this was discussed - but i expect function(--dashed-ident, fallback) is more clear, and invents less new syntax than --dashed-ident-as-function(fallback) Which is good, because now there is a proposal for more powerful custom functions using: --dashed-ident(custom, args) https://github.com/w3c/csswg-drafts/issues/7490