Recall & Review
beginner
What is a spacing scale in CSS or Sass?
A spacing scale is a set of predefined space values (like margins or paddings) that help keep consistent spacing throughout a website.
Click to reveal answer
beginner
Why use a spacing scale instead of random values?
Using a spacing scale keeps design consistent, makes code easier to maintain, and helps create a balanced layout.
Click to reveal answer
intermediate
How can you generate a spacing scale in Sass?
You can use Sass loops and lists to create a list of spacing values, then use those values throughout your styles.
Click to reveal answer
intermediate
Example: What does this Sass code do?
$spacing-scale: (0, 0.25rem, 0.5rem, 1rem, 2rem);
@mixin space($index) {
margin: nth($spacing-scale, $index);
}
It defines a list of spacing sizes and a mixin that applies margin using the spacing value at the given position in the list.
Click to reveal answer
beginner
What is the benefit of using rem units in spacing scales?
Rem units scale with the root font size, making spacing responsive and accessible across different devices and user settings.
Click to reveal answer
What is the main purpose of a spacing scale in Sass?
✗ Incorrect
A spacing scale helps maintain consistent spacing values throughout the design.
Which Sass feature helps generate spacing scales efficiently?
✗ Incorrect
Loops and lists allow you to create and use multiple spacing values easily.
Why are rem units preferred in spacing scales?
✗ Incorrect
Rem units adjust based on the root font size, improving responsiveness and accessibility.
What does this Sass code do?
$scale: (0, 1rem, 2rem);
margin: nth($scale, 2);
✗ Incorrect
nth($scale, 2) picks the second value, which is 1rem.
Which is NOT a benefit of using a spacing scale?
✗ Incorrect
Spacing scales avoid random values to keep design consistent.
Explain how you would create a spacing scale in Sass and use it in your styles.
Think about storing values and accessing them by position.
You got /3 concepts.
Why is using a spacing scale important for responsive and accessible web design?
Consider how spacing affects layout and user settings.
You got /4 concepts.