Why use animation mixins instead of writing animation CSS repeatedly?
Mixins save time and reduce mistakes by reusing animation code. They make it easy to change animation details in one place and keep your styles consistent.
Click to reveal answer
intermediate
What is the benefit of using parameters in animation mixins?
Parameters let you customize animations when you include the mixin. For example, you can change duration or delay without rewriting the whole animation code.
Click to reveal answer
intermediate
How can you combine multiple animations in one mixin?
You can list multiple animations separated by commas inside the mixin. This lets you apply several animations at once with one mixin call.
Click to reveal answer
Which Sass directive is used to create a mixin?
A@mixin
B@include
C@function
D@extend
✗ Incorrect
The @mixin directive defines a mixin. @include is used to use a mixin.
What does the animation-fill-mode: forwards; property do in an animation?
AKeeps the animation at its last frame after finishing
BRepeats the animation infinitely
CStarts the animation immediately
DDelays the animation start
✗ Incorrect
The forwards value keeps the element styled as it is at the end of the animation.
How do you pass a duration of 2 seconds to a mixin named fadeIn?
A@mixin fadeIn(2s);
BfadeIn: 2s;
Canimation-duration: 2s;
D@include fadeIn(2s);
✗ Incorrect
You use @include with the mixin name and pass the argument in parentheses.
Which of these is NOT a benefit of using animation mixins?
AReusing animation code easily
BChanging animation details in one place
CAutomatically creating keyframes
DKeeping styles consistent
✗ Incorrect
Mixins help reuse code but do not automatically create keyframes; you must define keyframes separately.
How can you apply two animations, slideIn and fadeOut, in one mixin?
B. Wrong mixin name 'bounce' instead of 'bounceAnimation'.
C. Animation-iteration-count cannot be infinite.
D. Missing colon ':' after 'animation-duration' property.
Solution
Step 1: Check property syntax inside mixin
CSS properties need a colon ':' between property and value.
Step 2: Locate the error
Line 'animation-duration $time;' misses the colon after 'animation-duration'.
Final Answer:
Missing colon ':' after 'animation-duration' property. -> Option D
Quick Check:
Property syntax requires ':' [OK]
Hint: CSS properties always need ':' between name and value [OK]
Common Mistakes:
Omitting colon after property name
Confusing parameter names
Thinking infinite is invalid for iteration count
5. You want to create a reusable animation mixin that accepts parameters for animation name, duration, delay, and easing. Which of the following mixin definitions correctly supports all these parameters with default values?