0
0
SASSmarkup~10 mins

Why variables reduce repetition in SASS - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a color variable in Sass.

SASS
$primary-color: [1];
Drag options to blanks, or click blank then click option'
Ablue
Bcolor
Cprimary
D#3498db
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name instead of a color value.
Forgetting the semicolon at the end.
2fill in blank
medium

Complete the code to use the variable $primary-color for the background color.

SASS
button {
  background-color: [1];
}
Drag options to blanks, or click blank then click option'
A$primary-color
Bprimary-color
Ccolor-primary
D#primary-color
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting the $ sign.
Adding extra characters like # before the variable.
3fill in blank
hard

Fix the error in the code to correctly use the variable for font color.

SASS
p {
  color: [1];
}
Drag options to blanks, or click blank then click option'
A$primary-color
B#primary-color
Cprimary-color
DprimaryColor
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without $.
Using camelCase instead of kebab-case.
4fill in blank
hard

Fill both blanks to create a variable and use it for border color.

SASS
[1]: #e74c3c;
.box {
  border: 2px solid [2];
}
Drag options to blanks, or click blank then click option'
A$alert-color
B$border-color
D#alert-color
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for definition and usage.
Omitting the $ sign in either place.
5fill in blank
hard

Fill all three blanks to define variables and use them for background and text colors.

SASS
[1]: #2ecc71;
[2]: #ffffff;
.card {
  background-color: [3];
  color: $text-color;
}
Drag options to blanks, or click blank then click option'
A$bg-color
B$text-color
D$background
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or misspelling them.
Forgetting the $ sign.