A CSS custom property is the same as CSS Variable . But that sounds like some kind of awkward name.
They were not mistaken for the page title: Using custom CSS properties (variables)
However, the CSS variable is not a variable in the traditional sense, since it cannot be defined so that it is globally bounded, as in a programming language, or by a CSS preprocessor (LESS / Sass).
Even a custom property / variable limited by the root is not global. Changing the property value in a child will not change the value above or for brothers and sisters in this area. If someone expects to be global, this can be confusing, and I suspect that Mozilla writers are trying to point out.
if you look
w3.org Custom CSS Properties for Cascading Variables
This module introduces a family of custom authoring properties, collectively known as custom properties.
Custom properties are definitions that can be referenced using var(--my-custom-prop) . Like a variable!
quote continue ...
since you only need to change the value in the user property only once, and this change will be automatically transferred to all uses of this variable.
Awkward ... The above statement is wrong. The Mozilla Developer Network documentation seems to be trying to clarify this idea so that it is less confusing. Repetition of the original quote :
Keep in mind that these are custom properties, not actual CSS variables. The value is calculated where necessary, is not stored for use in other rules. For example, you cannot set a property for an element and expect to receive it in a child child rule. The property is set only for the match selector and its descendants, like any regular CSS.
They indicate that is not a variable in the traditional sense of a programming language. But this is calculated in the same way as styles, following general CSS cascade / definition rules.
Thus, var(--my-custom-prop) can resolve very different things based on where it is declared and that the ads do not extend to a higher area.
Here's the code to do without if you want to try it.
So, think of CSS Custom Property as CSS Variable , but be sure to remember that values are cascaded and there is no global scope.