The hover media feature tests whether the user’s primary input can conveniently hover over elements.
Use @media (hover: hover) for mouse/trackpad-first devices and @media (hover: none) for touch-first phones and tablets (or when there is no primary pointing input). It is not the same as the :hover pseudo-class — the media feature is a capability query; :hover is live pointer-over styling.
Baseline · Widely available.
Not deprecated. Standard-track interaction media feature (Media Queries Level 4). Prefer touch-friendly defaults, then enhance when (hover: hover) matches.
Caveat Some devices mis-report
Certain Android OEMs and hybrid devices can report hover incorrectly. Do not hide essential UI behind hover-only styles.
Syntax
CSS Syntax
syntax.css
@media (hover:none | hover) { … }
Always wrap the feature in parentheses. Invalid forms like @media hover(hover) do not work.
Values
Feature Values
Value
Description
Try it
hover
Primary input can conveniently hover (mouse, trackpad)
Add screen. Limits the rule to screen (not print).
AND hover capability. Both conditions must match.
Then use :hover. Color shifts only for hover-capable primary inputs.
Edge Cases & Pitfalls
If hover styles feel “stuck” on phones, check these first.
vs :hover
Media feature ≠ pseudo-class
@media (hover) asks “can the primary input hover?” :hover styles the element while the pointer is over it. Use both together.
primary
Only the primary input
A touchscreen laptop may report hover: none even with a mouse attached. Check any-hover when any hover-capable device matters.
bugs
Mis-reported hover on some devices
Some Android builds have reported hover incorrectly. Keep critical actions visible without hover.
sticky
Ungated :hover sticks on touch
Without (hover: hover), first tap can leave :hover styles stuck until another tap. Gate hover chrome with the media feature.
a11y
Keyboard users still need focus
Pair interactive styles with :focus-visible. Hover capability does not replace keyboard focus indicators.
Compatibility
Browser Support
hover is a browser media feature. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available
hover
Widely supported since about Chrome 38+, Firefox 64+, Safari 9+, Edge 12+. IE does not support interaction media features. Treat device reporting quirks as progressive-enhancement caveats.
97%Core support
Google Chrome38+
Full support
Mozilla Firefox64+
Full support
Apple Safari9+
Full support
Microsoft Edge12+
Full support
Opera25+
Full support
Samsung Internet5+
Full support*
Internet Explorer—
No support
@media (hover)Widely supported
Bottom line: *Some Android OEMs have mis-reported hover. Safe for progressive enhancement; never hide essential UI behind hover-only styles. It is not a runtime API.
Remember
Key Takeaways
Role: detect whether the primary input can hover.
Values:hover and none inside @media (…).
vs :hover: capability query first, then live pointer styles.
Practice: defaults for touch; enhance for (hover: hover).
One line: ask if the primary input can hover, then decide whether :hover styles are safe to rely on.
Frequently Asked Questions
It tests whether the primary input mechanism can conveniently hover over elements. Use @media (hover: hover) for mouse/trackpad-first devices and @media (hover: none) for touch-first devices.
Two keywords: hover (primary input can hover) and none (primary input cannot hover conveniently, or there is no primary pointing input).
The media feature is a capability query evaluated before interaction. The :hover pseudo-class styles an element while the pointer is over it. Gate hover-only UI with the media feature; use :hover for live feedback.
hover checks only the primary input. any-hover checks whether any available input can hover — useful on hybrid devices with both touch and a mouse.
Yes. Some Android OEMs and hybrid devices mis-report primary hover. Prefer progressive enhancement: usable without hover, enhanced when (hover: hover) matches.
No. It is a CSS media feature evaluated by the browser layout engine, not a Node.js or server runtime feature.