Recall & Review
beginner
What is a mixin in Sass?
A mixin is a reusable group of CSS styles that you can include in other selectors to avoid repeating code.
Click to reveal answer
beginner
How do you include a mixin in Sass?
You use the
@include directive followed by the mixin name and optional arguments.Click to reveal answer
beginner
Example: What does
@include rounded-corners; do?It inserts the styles defined inside the
rounded-corners mixin into the current CSS rule.Click to reveal answer
intermediate
Can mixins accept parameters in Sass?
Yes, mixins can take parameters to customize the styles when included.
Click to reveal answer
beginner
Why use
@include instead of copying styles?Using
@include keeps your code DRY (Don't Repeat Yourself), easier to maintain, and reduces errors.Click to reveal answer
What does
@include do in Sass?✗ Incorrect
@include inserts the styles from a previously defined mixin into the current CSS rule.
How do you pass a parameter to a mixin when using
@include?✗ Incorrect
You pass parameters inside parentheses after the mixin name, like @include mixin-name(parameter);.
Which of these is the correct way to include a mixin named
box-shadow?✗ Incorrect
@include box-shadow; is the correct syntax to include a mixin.
What is the main benefit of using mixins with
@include?✗ Incorrect
Mixins help write less CSS by reusing style blocks, keeping code clean and organized.
If a mixin has parameters, what happens if you don’t provide them when using
@include?✗ Incorrect
If default values are set for parameters, Sass uses them when you don’t provide arguments.
Explain how to create and use a mixin with
@include in Sass.Think about how to write reusable style blocks and then apply them.
You got /3 concepts.
Why is using
@include with mixins better than copying CSS styles multiple times?Consider the idea of writing once and using many times.
You got /4 concepts.