0
0
Tailwindmarkup~20 mins

Hover variant in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Hover Variant Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
selector
intermediate
2: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"
AThe text color changes to blue (#3b82f6) on hover.
BThe text color changes to gray (#374151) on hover.
CThe text color stays gray (#374151) on hover.
DThe text color changes to red (#ef4444) on hover.
Attempts:
2 left
💡 Hint
Look at the part after 'hover:' to see the color applied on hover.
layout
intermediate
2:00remaining
Which element will have a shadow on hover?
Consider these two buttons with Tailwind classes:

<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?
ABoth buttons have shadows only on hover.
BButton 2 will have a shadow only on hover; Button 1 always has a shadow.
CNeither button will have a shadow on hover.
DButton 1 will have a shadow only on hover; Button 2 always has a shadow.
Attempts:
2 left
💡 Hint
Check which button has the 'shadow' class without 'hover:' prefix.
🧠 Conceptual
advanced
2:00remaining
What does the 'hover:' variant do in Tailwind CSS?
Choose the best description of what the 'hover:' variant does in Tailwind CSS classes.
AIt applies the styles permanently to the element regardless of user interaction.
BIt applies the specified styles only when the user hovers the mouse over the element.
CIt applies styles only when the element is focused via keyboard navigation.
DIt applies styles only when the element is clicked.
Attempts:
2 left
💡 Hint
Think about what 'hover' means in everyday computer use.
📝 Syntax
advanced
2:00remaining
Which Tailwind class correctly changes background on hover?
Which option correctly changes the background color to green when hovering over a div?
Aclass="bg-white hover:bg-green-500"
Bclass="bg-white bg-hover-green-500"
Cclass="bg-white hover:green-500"
Dclass="bg-white hover-bg-green-500"
Attempts:
2 left
💡 Hint
Remember the correct syntax uses a colon after 'hover'.
accessibility
expert
3: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?
ABecause hover styles are not supported by modern browsers.
BBecause hover styles slow down page loading times significantly.
CBecause keyboard users and touch screen users may not trigger hover, making content inaccessible.
DBecause hover styles automatically disable screen readers.
Attempts:
2 left
💡 Hint
Think about how people use devices without a mouse.