Recall & Review
beginner
What are CSS variables?
CSS variables are custom properties that store values you can reuse throughout your CSS. They start with two dashes, like
--main-color.Click to reveal answer
beginner
How do CSS variables help with consistency?
By using CSS variables, you can define a value once and use it many times. This keeps colors, fonts, and sizes consistent across your website.
Click to reveal answer
beginner
How do CSS variables make updating styles easier?
If you want to change a color or size, you only update the variable value once. All places using that variable update automatically.
Click to reveal answer
intermediate
Can CSS variables be changed with JavaScript?
Yes! You can change CSS variables dynamically using JavaScript, which helps create interactive and responsive designs.
Click to reveal answer
beginner
What is the syntax to use a CSS variable inside a style?
Use the
var() function. For example, color: var(--main-color); applies the value of --main-color.Click to reveal answer
What is the main benefit of using CSS variables?
✗ Incorrect
CSS variables let you store values once and reuse them, making your styles consistent and easier to update.
How do you define a CSS variable?
✗ Incorrect
CSS variables are defined with two dashes before the name inside a CSS selector, like
--main-color: blue;.Which function is used to access a CSS variable's value?
✗ Incorrect
The
var() function is used to get the value of a CSS variable, for example color: var(--main-color);.Can CSS variables be changed after the page loads?
✗ Incorrect
JavaScript can update CSS variables dynamically, allowing interactive style changes without reloading.
Why are CSS variables better than repeating the same value everywhere?
✗ Incorrect
Using variables avoids mistakes from typing values many times and lets you update styles quickly by changing one place.
Explain why CSS variables improve website style management.
Think about how changing one value can update many places.
You got /4 concepts.
Describe how CSS variables can be used with JavaScript.
Consider how websites change colors or themes on user actions.
You got /4 concepts.