Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the purpose of state classes like :hover, :active, and :disabled in CSS/Sass?
They define how elements look or behave when users interact with them, such as when hovering with a mouse, clicking, or when an element is disabled and not interactive.
Click to reveal answer
intermediate
How can you generate multiple state classes in Sass efficiently?
By using Sass features like @each loops and mixins to write reusable code that applies styles for each state without repeating code.
Click to reveal answer
beginner
What does the & symbol represent in Sass when used inside a nested selector?
It refers to the parent selector, allowing you to append pseudo-classes or other selectors to the current selector.
Click to reveal answer
intermediate
Write a simple Sass mixin to generate styles for :hover, :active, and :disabled states.
A mixin can loop through states and apply styles like this:
C. Using &:disabled instead of &.disabled for disabled class
D. Mixin name should be capitalized
Solution
Step 1: Check pseudo-class vs class usage
:disabled is a pseudo-class for form elements, but here disabled is a class, so &.disabled is correct.
Step 2: Verify other syntax
Semicolons are present, mixin naming is flexible, and mixins can be used inside classes.
Final Answer:
Using &:disabled instead of &.disabled for disabled class -> Option C
Quick Check:
Use .disabled class selector, not :disabled pseudo-class [OK]
Hint: Use .disabled class, not :disabled pseudo-class [OK]
Common Mistakes:
Confusing :disabled pseudo-class with .disabled class
Forgetting semicolons
Thinking mixins need capital letters
5. You want to create a reusable Sass mixin that adds hover, active, and disabled states to any button. The disabled state should make the button look faded and prevent clicks. Which of these mixins correctly implements this behavior?