The any-pointer media feature tests whether any available pointing device exists, and how accurate it is.
Use @media (any-pointer: fine) when a mouse, trackpad, or stylus is present. Use @media (any-pointer: coarse) when a finger or other imprecise pointer is available. Use @media (any-pointer: none) when there is no pointing device. Unlike pointer, it is not limited to the primary input — useful on hybrid touch + mouse devices.
Baseline · Widely available.
Not deprecated. Standard-track interaction media feature (Media Queries Level 4). Widely available since December 2018. Prefer comfortable touch targets by default, then refine for precision when needed.
Caveat Both fine and coarse can match
A laptop with a touchscreen can match fine and coarse at the same time. none matches only when no pointing device exists. Cascading order matters.
Syntax
CSS Syntax
syntax.css
@media (any-pointer:none | coarse | fine) { … }
Always wrap the feature in parentheses. Invalid forms like @media any-pointer(fine) do not work.
On hybrid devices these two lines can disagree. any-pointer may list more than one match.
How It Works
Query primary pointer.pointer reflects the main pointing device.
Query any pointer.any-pointer scans all pointing devices.
Compare the results. A touch-first laptop with a mouse may differ.
Pick the right feature. Use any-pointer when accessory pointers matter.
Edge Cases & Pitfalls
Hybrid devices are where any-pointer and pointer most often disagree.
vs pointer
Any input vs primary input
pointer is primary-only. any-pointer is true for each matching device class. Prefer any-pointer for accessory mice and pens.
both match
fine and coarse together
Both can match on convertibles. Put the safer (usually coarser) rules later in the cascade, or avoid shrinking targets when coarse also matches.
defaults
Tiny defaults fail on touch
Do not start with 24×24 px controls and only enlarge for coarse. Ship comfortable defaults, then refine for fine.
a11y
Keyboard users still need focus
Pointer accuracy does not replace :focus-visible. Keep focus rings clear for keyboard navigation.
Compatibility
Browser Support
any-pointer is a browser media feature. Node.js, Deno, and Bun do not evaluate it.
✓ Baseline · Widely available since Dec 2018
any-pointer
Chrome 41+, Edge 12+, Firefox 64+, Safari 9+, Opera 28+, Samsung Internet 4+. Internet Explorer has no support.
97%Global reach
Google Chrome41+
Full support
Mozilla Firefox64+
Full support
Apple Safari9+
Full support
Microsoft Edge12+
Full support
Opera28+
Full support
Samsung Internet4+
Full support
Internet Explorer—
No support
@media (any-pointer)Widely supported
Bottom line: Safe for progressive enhancement. Keep touch-friendly defaults. It is not a server runtime API.
Remember
Key Takeaways
Role: detect precision of any available pointing device.
Values:fine, coarse, and none inside @media (…).
vs pointer: any input, not only the primary one.
Practice: roomy defaults; enlarge for coarse; tighten carefully for fine.
One line: ask how accurate any pointer is, then size interactive targets to match.
Frequently Asked Questions
It tests whether any available pointing device exists and how accurate it is. Use @media (any-pointer: fine), (any-pointer: coarse), or (any-pointer: none).
Three keywords: fine (accurate pointer like a mouse), coarse (limited accuracy like a finger), and none (no pointing device).
pointer checks only the primary pointing device. any-pointer checks all pointing devices — a tablet with a mouse can match fine even if the primary pointer is coarse.
Yes. On hybrid devices both can match at once. none matches only when there is no pointing device. Order your CSS carefully when both fine and coarse rules apply.
Prefer any-pointer when accessory pointers matter (external mouse on a phone or tablet). Prefer pointer when you care only about the primary input.
No. It is a CSS media feature evaluated by the browser layout engine, not a Node.js or server runtime feature.