0
0
SASSmarkup~5 mins

Variable declaration with $ in SASS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the $ symbol represent in Sass?
In Sass, the $ symbol is used to declare a variable. It helps store values like colors, sizes, or fonts that you can reuse throughout your stylesheet.
Click to reveal answer
beginner
How do you declare a variable named $main-color with the value #3498db in Sass?
You write:
$main-color: #3498db;
This sets $main-color to a blue color you can use later.
Click to reveal answer
beginner
Why use variables in Sass instead of repeating values?
Variables make your code easier to update and maintain. Change the value once, and it updates everywhere the variable is used, saving time and reducing mistakes.
Click to reveal answer
intermediate
Can you change the value of a Sass variable after it is declared?
Yes, Sass variables can be reassigned later in the same scope, and the new value will be used in subsequent rules.
Click to reveal answer
beginner
How do you use a Sass variable inside a CSS rule?
Use the variable by writing its name with $. For example:
color: $main-color;
This applies the stored color value.
Click to reveal answer
What symbol starts a variable name in Sass?
A%
B#
C@
D$
Which of these is a correct Sass variable declaration?
A$font-size: 16px;
Bfont-size = 16px;
C@font-size: 16px;
Dfont-size: $16px;
If you want to change a color used many times, what is the best Sass practice?
AChange each color manually
BUse a variable and change its value once
CUse inline styles
DUse !important everywhere
Can you reassign a Sass variable after it is set?
AYes, anytime
BOnly if you use !default
COnly inside media queries
DNo, variables are immutable
How do you apply a Sass variable $main-color to a CSS property?
Acolor: main-color;
Bcolor: #main-color;
Ccolor: $main-color;
Dcolor: var(main-color);
Explain how to declare and use a variable in Sass with an example.
Think about how you store a color once and use it multiple times.
You got /4 concepts.
    Why are variables helpful in Sass? Describe a real-life situation where they save time.
    Imagine changing a color on a website with many pages.
    You got /4 concepts.