CSS Tutorial
CSS variables let you store and reuse values throughout your stylesheet, enhancing code maintainability and flexibility.
-- (e.g., --color-background).var() function to assign values to variables (e.g., var(--color-background, black)).var() in place of values (e.g., background-color: var(--color-background)).CSS
/* Define reusable variables */
:root {
--color-primary: #FF0000;
--color-secondary: #00FF00;
}
/* Use variables in styles */
h1 {
color: var(--color-primary);
}
p {
color: var(--color-secondary);
}