The pointer media feature detects the primary pointing device — mouse, touchscreen, or none. Adapt button sizes, spacing, and hover behavior for how users mainly interact with your page.
01
@media
Media query.
02
fine
Mouse/trackpad.
03
coarse
Touchscreen.
04
none
Keyboard only.
05
vs any
Primary only.
06
+ hover
Pair features.
Fundamentals
Introduction
Not every visitor uses a mouse. Phones rely on fingers, some users navigate with keyboards only, and hybrid laptops offer both touch and trackpad. The @media (pointer) feature tells CSS which primary pointing device is in use.
This is different from any-pointer, which checks all available pointing devices. The pointer feature focuses on the main input method only.
Definition and Usage
Wrap rules in @media (pointer: fine), @media (pointer: coarse), or @media (pointer: none). Enlarge tap targets on coarse, enable hover-rich UI on fine, and keep keyboard navigation clear when none matches.
💡
Beginner Tip
Start with touch-friendly defaults (large buttons, no hover-only actions). Then add fine-pointer enhancements like compact toolbars and :hover styles under @media (pointer: fine).
Foundation
📝 Syntax
Use fine, coarse, or none inside an @media rule:
syntax.css
@media(pointer:fine){/* Mouse or trackpad is primary */}@media(pointer:coarse){/* Touchscreen is primary */}@media(pointer:none){/* No pointing device (keyboard only) */}
Accepted Values
fine — High-precision pointer such as a mouse, trackpad, or stylus (small targets work well).
coarse — Low-precision pointer such as a finger on a touchscreen (use larger tap targets).
none — No pointing device; user relies on keyboard or other non-pointer input.
pointer vs any-pointer
(pointer: coarse) Primary input only — a touchscreen laptop may stay coarse even with a mouse plugged in.
(any-pointer: fine) Any input available — matches when a mouse exists among connected devices.
pointer vs :hover Selector
@media (pointer: fine) Media query — applies styles when the primary device is precise (often paired with hover rules).
a:hover { } CSS selector — styles an element while the cursor is over it (does not detect device type).
Keyboard navigation — Users with pointer: none rely on Tab and Enter.
Visible focus — Provide clear :focus-visible styles for all interactive elements.
No hover-only content — Tooltips and menus must work without hovering.
Spacing — Add margin between adjacent tap targets on coarse pointers.
🧠 How pointer Works
1
Browser detects primary input
Identifies whether touch, mouse, or no pointer is the main pointing device.
Detect
2
Media query matches a value
fine, coarse, or none.
Match
3
@media rules apply
Matching blocks update sizes, spacing, and hover behavior.
Apply
=
🖱
Input-aware UI
Layout respects how users primarily point and tap.
Compatibility
🖥 Browser Compatibility
The pointer media feature is supported in all modern browsers on desktop, tablet, and mobile.
✓ Baseline · Universal support
Primary pointer queries
Works in Chrome, Firefox, Safari, Edge, and Opera.
99%Global support
pointer media feature99% supported
Bottom line:pointer is production-ready. Combine with any-pointer and hover for complete input-aware design.
Wrap Up
🎉 Conclusion
The pointer media feature helps you tailor UI to the primary pointing device. Use coarse for touch-friendly sizing, fine for hover-rich desktop UI, and none for keyboard-first accessibility.
Pair it with any-pointer on hybrid devices and always keep touch-friendly defaults as your foundation.
Use these points when building input-aware interfaces.
5
Core concepts
C01
coarse
Touch primary.
Value
F02
fine
Mouse primary.
Value
P03
Primary only
Not any-pointer.
Concept
H04
+ hover
Pair features.
Pattern
4405
Touch size
Min tap target.
A11y
FAQ
❓ Frequently Asked Questions
What does the CSS pointer media feature do?
The pointer media feature reports the precision of the user's primary pointing device — fine (mouse or trackpad), coarse (touchscreen), or none (keyboard-only). Use @media (pointer: fine), (pointer: coarse), or (pointer: none) to adapt UI for the main input method.
What is the difference between fine and coarse?
fine means a high-precision pointer like a mouse that can hit small targets accurately. coarse means a low-precision pointer like a finger on a touchscreen — larger tap targets (at least 44×44px) are recommended.
What is the difference between pointer and any-pointer?
pointer checks only the primary pointing device. any-pointer checks all available pointing devices. A touchscreen laptop may report pointer: coarse even when a mouse is connected, while any-pointer: fine may still match because the mouse exists.
When should I use pointer in responsive design?
Use pointer when styles should follow the primary input method: enlarge buttons on touch-primary devices, enable hover-dependent layouts on fine-primary devices, and simplify UI when pointer: none.
Is pointer widely supported in browsers?
Yes. The pointer media feature is supported in all modern browsers including Chrome, Firefox, Safari, Edge, and Opera. It is safe for production alongside touch-friendly defaults.