Challenge - 5 Problems
Hover Variant Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ selector
intermediate2:00remaining
What color will the text be on hover?
Given the following Tailwind CSS class, what color will the text become when the user hovers over the element?
class="text-gray-700 hover:text-blue-500"Attempts:
2 left
💡 Hint
Look at the part after 'hover:' to see the color applied on hover.
✗ Incorrect
The class 'hover:text-blue-500' changes the text color to blue when the mouse is over the element. The base color is gray-700, but on hover it switches to blue-500.
❓ layout
intermediate2:00remaining
Which element will have a shadow on hover?
Consider these two buttons with Tailwind classes:
Which button will show a shadow only when hovered?
<button class="bg-white hover:shadow-lg p-4">Button 1</button>
<button class="bg-white shadow hover:shadow-lg p-4">Button 2</button>Which button will show a shadow only when hovered?
Attempts:
2 left
💡 Hint
Check which button has the 'shadow' class without 'hover:' prefix.
✗ Incorrect
Button 1 has no shadow by default but adds 'shadow-lg' on hover. Button 2 has 'shadow' always and adds 'shadow-lg' on hover, so it always shows a shadow.
🧠 Conceptual
advanced2:00remaining
What does the 'hover:' variant do in Tailwind CSS?
Choose the best description of what the 'hover:' variant does in Tailwind CSS classes.
Attempts:
2 left
💡 Hint
Think about what 'hover' means in everyday computer use.
✗ Incorrect
The 'hover:' variant in Tailwind applies styles only when the mouse pointer is over the element, i.e., on hover.
📝 Syntax
advanced2:00remaining
Which Tailwind class correctly changes background on hover?
Which option correctly changes the background color to green when hovering over a div?
Attempts:
2 left
💡 Hint
Remember the correct syntax uses a colon after 'hover'.
✗ Incorrect
The correct syntax for hover variant in Tailwind is 'hover:' followed by the utility class. Only option A uses this correctly.
❓ accessibility
expert3:00remaining
Why should you not rely only on hover styles for important information?
In terms of accessibility, why is it a bad idea to show important content only on hover using Tailwind's hover variant?
Attempts:
2 left
💡 Hint
Think about how people use devices without a mouse.
✗ Incorrect
Hover styles only activate with a mouse pointer. Keyboard-only users and touch screen users cannot trigger hover, so important info shown only on hover is hidden from them.