media-feature

Any hover — CSS reference

Matches if any available pointing mechanism can conveniently hover, even when the primary one cannot. A hover capability is optional enhancement, not a requirement for accessing controls.

Formal Syntax & Structure

css syntaxcss
@media (any-hover: hover) { /* conditional declarations */ }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>any-hover</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}@media (any-hover: hover) {#a{color:rgb(0,100,0)}}</style><body><main id="a">Resize the viewport to explore this example.</main></body></html>
CSS Reference