HTML & CSS EnhancementsLesson 27Free preview
Custom Properties
This lesson is part of Intro to HTML & CSS · All levels
Summary
Custom properties (CSS variables) allow you to define a value once and then use it multiple times through the var() function. Its main advantage: changing one declaration updates the entire usage, and the variable can be overridden to create a theme. This is a modern feature that must be mastered.
Key points
- Declaration: --name: value; usually on the root to global
- Use: var(--namavar, fallback) to take its value
- Variable facilitates theming including dark mode
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.