Hacker News new | ask | show | jobs
by pornel 4430 days ago
CSS Variables are a misnomer. They're custom properties that obey cascade and inheritance.

CSS preprocessors can do only lexically scoped substitutions. With CSS "variables" you can have values inherited within DOM's scope.

1 comments

Can you give an example of a situation where you would rather have cascading variables than lexical scope?
• JS libraries implementing polyfills for new CSS properties or their own CSS-like behaviors (e.g. `--masonry-display: jagged-grid`)

• themes (`--theme-color` that can be inherited and overridden just like `color` would)