The :hover pseudo-class matches an element while a pointing device is over it — usually when the mouse cursor rests on the element without pressing.
Use it for feedback on links, buttons, and cards. For links, place :hover after :link / :visited and before :active (LVHA order).
Baseline Widely available.
Long-supported CSS pseudo-class across modern browsers.
Warning — touchscreens.
On touch devices, :hover may never match, match briefly, or stick after a tap. Do not hide essential content behind hover alone. Prefer @media (hover: hover) for hover-only extras.
Syntax
CSS Syntax
syntax.css
:hover{ /* styles */ }
Often combined with a type or class: a:hover, .btn:hover.
Use :active for the pressed state. It should come after :hover for links.
Compatibility
Browser Support
:hover is a browser CSS pseudo-class. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available
:hover
Supported in all major browsers for decades (Baseline Widely available since about July 2015).
99%All modern browsers
Google ChromeAll
Full
Mozilla FirefoxAll
Full
Apple SafariAll
Full
Microsoft EdgeAll
Full
OperaAll
Full
Samsung InternetAll
Full
Internet ExplorerAll
Full
:hoverUniversally supported
Bottom line: Production-ready. Plan for touch and keyboard separately from hover. Not a server runtime API.
Remember
Key Takeaways
Role: style an element while the pointer is over it.
Links: LVHA — :link, :visited, :hover, :active.
Touch: do not hide essential UI behind hover alone.
Tip: pair with :focus and optional @media (hover: hover).
One line:selector:hover styles the element while the pointer is over it.
Frequently Asked Questions
It matches an element while a pointing device (usually a mouse pointer) is over that element, without requiring a click.
:hover applies while the pointer is over the element. :active applies only while the element is being pressed.
For links, write :link, then :visited, then :hover, then :active. That order keeps hover and active styles from being overridden incorrectly.
It is unreliable. Some browsers never match :hover on touch, others match briefly or stick until another tap. Do not rely on hover alone for essential UI.
Yes. Use a media feature such as @media (hover: hover) so hover-only styles apply on devices that can hover.
No. It is a browser CSS pseudo-class, not a Node.js feature.