Declaring a custom property
Custom properties (officially "CSS Custom Properties for Cascading Variables Module") are declared with a double-dash prefix and defined on an element so they cascade down its descendants.
:root {
--color-primary: #4f46e5;
--radius-lg: 14px;
--spacing: 16px;
}
Using the variable
Reference a custom property with var(--name). If the variable is not defined, you can provide a fallback as the second argument.
.button {
background: var(--color-primary, #0066cc);
padding: calc(var(--spacing) * 2);
border-radius: var(--radius-lg);
}