HTML & CSS · Middle · Question 27 of 75

How do CSS variables (--x) fundamentally differ from Sass variables ($x)?

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.

Further reading

Problem with a question

HTML & CSS · Middle · question 27

Test yourself

Take the HTML & CSS · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz