Recall & Review
beginner
What is the
active variant in Tailwind CSS?The
active variant in Tailwind CSS applies styles when an element is being clicked or pressed by the user, like a button being held down.Click to reveal answer
beginner
How do you write a Tailwind class to change background color when a button is active?Use the
active: prefix before the class. For example, active:bg-blue-700 changes the background to blue when the button is pressed.Click to reveal answer
beginner
Why is the
active variant useful in web design?It gives users feedback that their click is recognized by changing the element's style while pressing, improving user experience and accessibility.
Click to reveal answer
intermediate
Can the
active variant be combined with other variants in Tailwind CSS?Yes! You can combine
active with others like hover or focus to style elements differently for each interaction state.Click to reveal answer
beginner
Example: What does this class do? <code>active:scale-95</code>It makes the element slightly smaller (scaled to 95%) while it is being pressed, giving a subtle 'pressed' effect.
Click to reveal answer
What does the Tailwind class
active:bg-red-500 do?✗ Incorrect
The
active: prefix applies styles only while the element is being clicked or pressed.Which user action triggers the
active variant styles?✗ Incorrect
The
active variant applies styles when the user clicks and holds the element.Can you combine
active: with hover: in Tailwind CSS?✗ Incorrect
Tailwind allows combining variants like
hover: and active: to style different interaction states.What visual effect does
active:scale-95 create?✗ Incorrect
Scaling to 95% shrinks the element slightly while it is active (pressed).
Why should you use the
active variant on buttons?✗ Incorrect
Using
active gives users visual feedback that their click is recognized.Explain how the
active variant works in Tailwind CSS and why it is important for user experience.Think about how buttons feel when you press them.
You got /4 concepts.
Describe how you would combine
active with other variants like hover and focus in Tailwind CSS.Consider how buttons change on hover, focus, and active states.
You got /4 concepts.