pseudo-class
:hover Pseudo-Class
Applies while the user designates an element with a pointing device without necessarily activating it. Most commonly used for interactive elements like links and buttons.
:hover Example
a:hover { text-decoration: underline; } /* HTML: <a href="#">Link</a> */ ✓ Matches
- <a href="#">Link</a> while hovered
- <button>Save</button> while hovered
- <div class="card"></div> while hovered
✗ Does not match
- <a href="#">Link</a> when the pointer is elsewhere
- any element on a touch-only device with no pointer
Browser support
Universal support in all browsers since CSS2.