Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to define a mixin named 'box' that takes one parameter.
SASS
@mixin box([1]) { width: 100px; height: 100px; background-color: red; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the dollar sign before the parameter name.
Using a parameter name unrelated to the mixin purpose.
✗ Incorrect
The mixin 'box' takes one parameter named $size, which can be used inside the mixin.
2fill in blank
mediumComplete the code to use the parameter $color inside the mixin to set background color.
SASS
@mixin colored-box($color) {
width: 100px;
height: 100px;
background-color: [1];
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the parameter name without the dollar sign.
Using a fixed color instead of the parameter.
✗ Incorrect
Inside the mixin, use the parameter $color to set the background-color property.
3fill in blank
hardFix the error in the mixin call to pass the color parameter correctly.
SASS
.box {
@include colored-box([1]);
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the color with a dollar sign, which is for variables only.
Passing the color as a string with quotes.
✗ Incorrect
When calling a mixin, pass the color value without a dollar sign or quotes if it's a color name.
4fill in blank
hardFill both blanks to create a mixin that sets width and height using parameters.
SASS
@mixin size-box([1], [2]) { width: [1]; height: [2]; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same parameter for both width and height.
Forgetting the dollar sign in parameter names.
✗ Incorrect
The mixin takes two parameters $width and $height to set the width and height properties.
5fill in blank
hardFill all three blanks to create a mixin that sets border width, style, and color.
SASS
@mixin border-style([1], [2], [3]) { border-width: [1]; border-style: [2]; border-color: [3]; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names that don't match border properties.
Mixing up the order of parameters.
✗ Incorrect
The mixin uses three parameters $width, $style, and $color to set border properties.