Custom properties (CSS variables)

Custom properties, or CSS variables, are declared with two dashes (--couleur-principale) and used with var(). Often defined in :root, they centralize reused values, inherit like other properties, and can be changed at runtime, for example for a theme.

Example

:root { --accent: #0a5; }
.bouton { background: var(--accent); }

Related concepts

The whole glossary