← CodePrimer
CSS Beginner Basics

CSS custom properties

How do I reuse colors with variables?

var(--token) custom properties.

Sample
:root {
  --brand: #2563eb;
  --radius: 0.5rem;
}
.btn {
  background: var(--brand);
  border-radius: var(--radius);
}

Notes

Change :root tokens to theme a whole site.

Keywords: variables · custom properties · var · theme

Related

Need more coins?

You do not have enough coins for this action.

Your balance: 0 coins

Share