CSS pointer Media Feature

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The pointer media feature tests whether the user has a primary pointing device, and how accurate it is: fine (mouse), coarse (finger), or none.

Use it to size tap targets and controls for the main input method. To test any pointing device (not only the primary one), use any-pointer instead.

Standard-track.

Baseline widely available since December 2018. Not deprecated, experimental, or non-standard.

Accessibility targets

Prefer larger hit areas for coarse. Avoid making fine-pointer controls too small—roomy targets help everyone.

CSS Syntax

syntax.css
@media (pointer: none | coarse | fine) { … }

Put UI rules inside the query that matches the primary pointer you want to design for.

Feature Values

ValueDescriptionTry it
fineAccurate primary pointer (mouse, trackpad, stylus)Try it
coarseLimited accuracy (finger on a touchscreen)Try it
nonePrimary input has no pointing deviceTry it
fine + coarse sizingSmall vs large control patternTry it

How to Use pointer

Start with usable defaults, then enlarge for coarse pointers.

  1. Ship comfortable default hit areas for all users.
  2. Add @media (pointer: coarse) to increase padding or control size on touch-primary devices.
  3. Optionally tighten dense UI under (pointer: fine)—without going too small.
  4. Use any-pointer when a secondary mouse or stylus should also count.
GoalTypical query
Bigger touch targets(pointer: coarse)
Dense desktop controls(pointer: fine)
Keyboard-first UI(pointer: none)

Live Preview

This browser’s current match for pointer (via matchMedia).

Detected value

Chips show which query matches here. The device value cannot be forced from the page.

Result

Checking…

matchMedia pending

CSS Examples

Each snippet focuses on pointer. Use Try It Yourself for a live editor.

Example 1 — Larger Targets for Coarse Pointers

Increase button padding when the primary pointer is a finger.

CSS
<style>
  button {
    padding: 0.5em 1em;
  }

  @media (pointer: coarse) {
    button {
      padding: 1em 2em;
    }
  }
</style>

<button type="button">Save</button>
Try It Yourself

How It Works

  1. Set a baseline. Default padding works for most devices.
  2. Query coarse. @media (pointer: coarse) matches touch-primary phones and tablets.
  3. Enlarge the hit area. Extra padding makes taps easier.
  4. No match. Mouse-primary desktops keep the smaller default.

Example 2 — Compact Controls for Fine Pointers

Use a denser button when the primary pointer is accurate.

CSS
<style>
  button {
    padding: 0.75em 1.25em;
  }

  @media (pointer: fine) {
    button {
      padding: 0.4em 0.8em;
    }
  }
</style>

<button type="button">Edit</button>
Try It Yourself

How It Works

  1. Keep a safe default. Mid-size padding first.
  2. Match fine. Desktops with a mouse typically report fine.
  3. Tighten carefully. Slightly less padding for dense toolbars.
  4. Do not overshrink. Tiny targets strain even mouse users.

Example 3 — Fine vs Coarse Checkbox Size

Switch control size based on primary pointer accuracy (MDN-style pattern).

CSS
<style>
  input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
  }

  @media (pointer: fine) {
    input[type="checkbox"] {
      width: 0.9rem;
      height: 0.9rem;
    }
  }

  @media (pointer: coarse) {
    input[type="checkbox"] {
      width: 1.5rem;
      height: 1.5rem;
    }
  }
</style>

<label><input type="checkbox"> Remember me</label>
Try It Yourself

How It Works

  1. Start with a default size. Covers unknown or unsupported cases.
  2. Branch on fine. Slightly smaller checkbox for precise pointers.
  3. Branch on coarse. Larger checkbox for fingers.
  4. One primary match. A device reports one primary value, so only one branch applies.

Edge Cases & Pitfalls

If the wrong branch seems active, one of these is usually why.

primary

Only the primary pointer counts

A touchscreen laptop may report coarse even with a mouse attached. Use any-pointer when any fine device should win.

hover

Pointer is not hover

Accuracy and hover ability are different questions. Pair with hover when menus rely on hover.

size

Do not overshrink for fine

Smaller is not always better. Keep controls easy to hit; enlarge for coarse instead of squeezing fine too hard.

width

Do not infer input from viewport width

Large tablets and small laptops break width-based guesses. Prefer pointer / hover over assuming touch from screen size.

none

none is uncommon but real

Keyboard-first or some assistive setups may report none. Keep focus styles strong and do not rely on pointer-only UI.

Browser Support

pointer is a browser CSS media feature for primary pointing accuracy. Node.js, Deno, and Bun do not evaluate it.

✓ Baseline · Widely available since Dec 2018

pointer

Supported in Chrome 41+, Firefox 64+, Safari 9+, Edge 12+, Opera 28+, Samsung Internet 5+. Not supported in Internet Explorer.

97% Global support
Google Chrome 41+
Full support
Mozilla Firefox 64+
Full support
Apple Safari 9+
Full support
Microsoft Edge 12+
Full support
Opera 28+
Full support
Samsung Internet 5+
Full support
Internet Explorer No
Not supported
pointer Widely supported

Bottom line: Safe for production. Keep usable default sizes outside the query for older clients.

Key Takeaways

  • Role: reports primary pointing accuracy—fine, coarse, or none.
  • Common use: enlarge tap targets for coarse.
  • vs any-pointer: pointer is primary only; any-pointer checks all devices.
  • Pitfall: do not guess touch from screen width alone.

One line: use @media (pointer: coarse) to grow controls for fingers; keep defaults usable for everyone else.

Frequently Asked Questions

It reports whether the primary input includes a pointing device and how accurate that pointer is: fine (mouse), coarse (finger), or none.
fine is high accuracy (mouse, trackpad, stylus). coarse is limited accuracy (finger on a touchscreen). Coarse UIs need larger tap targets.
pointer checks only the primary pointing device. any-pointer checks every available pointer. A touch laptop may be pointer: coarse while still matching any-pointer: fine if a mouse is attached.
pointer is about pointing accuracy. hover asks whether the primary input can hover. Pair them when you need both touch targets and hover-only UI.
You can, but keep usable hit areas. Larger targets help everyone. Prefer enlarging for coarse rather than shrinking aggressively for fine.
Baseline widely available since December 2018: Chrome 41+, Firefox 64+, Safari 9+, Edge 12+. Not supported in Internet Explorer. It is a browser CSS media feature, not a Node.js API.

Next: print

Style pages for paper and print preview with the print media type.

print tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful