Описание тега css-variables
Variables allow to define stylesheet-wide values identified by a token and usable in all CSS declarations.
CSS variables are entities defined by CSS authors that contain specific values to be reused throughout a document. developer.mozilla
They are set using custom property notation (e.g., --main-color: black;
) and are accessed using the var() function (e.g., color: var(--main-color);
).
Example
/* Declaring a variable */
:root {
--main-bg-color: brown;
}
/* Using the variable */
element {
background-color: var(--main-bg-color);
}