HTML & CSS · Middle · Question 27 of 75
How do CSS variables (--x) fundamentally differ from Sass variables ($x)?
- 1No difference: Sass just compiles
$xinto--x, and they work the same afterwards - 2CSS variables are supported only in Chromium, so Sass is more reliable
- ✓Correct answer:
--xlives in the browser and changes at runtime, while$xis substituted at build time
Explanation
A Sass variable is a compile-time value; it doesn't exist in the output CSS. A custom property takes part in the cascade: it can be overridden per component, in @media, on :hover, in a dark theme, or from JavaScript via style.setProperty. They're usually combined: Sass for build logic, CSS variables for themes and dynamics.