Variables and tokens
Store colours, spacing and type values in one place.
What you will be able to do
- Use $name for Sass variables.
- Group tokens by role.
- Use maps for spacing and type scales.
- Use CSS variables for runtime themes.
In plain English
Variables make design decisions reusable. Group them by role, not by value, and prefer maps for scales. CSS custom properties are still the right tool for runtime theming.
$brand: #2f74c0;
$space: (sm: 8px, md: 16px, lg: 24px);
$radius: 12px;
.card {
padding: map-get($space, md);
border-radius: $radius;
color: $brand;
}Your turn
EasyCreate a token
Create a $brand variable and use it as a colour.
SCSS · starter
$brand: #2f74c0;Check your understanding before moving on.
Knowledge checkQuestion 1
Which prefix declares a Sass variable?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.