W3.CSSLesson 25Free preview
W3.CSS Variables
This lesson is part of W3.CSS · All levels
Summary
CSS variables or custom property allows you to store values like color and distance in a name that can be used repeatedly. The value is defined by a mark -- and then called using var(), so the theme change is pretty much touching one spot. This feature makes the style sheet more neat, consistent, and easy to maintain.
Key points
- Variables are defined by a pattern -- name: value;
- Variables are used with var(--nama) and may have a reserve value
- The global definition is usually placed in the selector:root
- The variable follows the scope, so it can be impacted on a particular block.
- The name of the variable must be preceded by two hyphen and be characterised by letters
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.