Suggest an editImprove this articleRefine the answer for “How do you declare and use a variable in CSS?”. Your changes go to moderation before they’re published.Approval requiredContentWhat you’re changing🇺🇸EN🇺🇦UAPreviewTitle (EN)Short answer (EN)**A CSS variable** is declared with `--name` inside any selector (most often in `:root`) and used with `var()`. **Key point:** `--main-color` and `--padding` are custom CSS variables, and `var()` substitutes their value.Shown above the full answer for quick recall.Answer (EN)ImageCSS variables are declared with `--name` inside any selector (most often in `:root`), and used with `var()`. **Declaration:** ```css :root { --main-color: #4a90e2; --padding: 16px; } ``` **Usage:** ```css button { color: var(--main-color); padding: var(--padding); } ``` `--main-color` and `--padding` are custom CSS variables, and `var()` substitutes their value.For the reviewerNote to the moderator (optional)Visible only to the moderator. Helps review go faster.