Tailwind CSS
/Beginner
Hover State
Definition
A state variant (`hover:`) that applies a utility class ONLY when the user's mouse cursor is resting over the element.
Explain Like I'm New
When a user mouses over a blue button, you want it to turn dark blue to signal that it is clickable. You simply add `hover:bg-blue-700`.
Real World Example
Applying `hover:underline` to a blue text link so it underlines exactly like a classic 1990s webpage when the user puts their mouse over it.
Common Use Cases
- •Buttons
- •Links
- •Interactive cards
Interactive Example
Interview Questions
basic
- What prefix do you use to change the text color to red when the mouse is over an element?
intermediate
- Does the `hover:` state work on mobile touch screens?