This feature is well established and works across many devices and browser versions. It’s been available across browsers since December 2018.
The hover CSS media feature can be used to test whether the user's primary input mechanism can hover over elements.
The hover feature is specified as a keyword value chosen from the list below.
<a href="#">Try hovering over me!</a>
/* default hover effect */
a:hover {
color: black;
background: yellow;
}
@media (hover: hover) {
/* when hover is supported */
a:hover {
color: white;
background: black;
}
}
| Specification |
|---|
| Media Queries Level 4> # hover> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hover |
38Before Chrome 41, the implementation was buggy and reported(hover: none) on non-touch-based computers with a mouse/trackpad. See bug 40397980. |
12 | 64 | 25Before Opera 28, the implementation was buggy and reported(hover: none) on non-touch-based computers with a mouse/trackpad. See bug 40397980. |
9 | 50On some Android devices, such as certain Samsung models, the(hover: hover) media query may incorrectly match. See bug 41445959. |
64 | 37On some Android devices, such as certain Samsung models, the(hover: hover) media query may incorrectly match. See bug 41445959. |
9 | 5.0On some Android devices, such as certain Samsung models, the(hover: hover) media query may incorrectly match. See bug 41445959. |
50On some Android devices, such as certain Samsung models, the(hover: hover) media query may incorrectly match. See bug 41445959. |
9 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover