Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Scrolling, Interaction and UI

The pointer-events property

Reference for the CSS pointer-events property: let clicks and hovers pass through an element, re-enable them on children, and avoid the keyboard trap.

The pointer-events property decides whether an element can be the target of mouse, touch and pen input. With the default auto, the element reacts to clicks, taps and hovering. With none, the pointer behaves as if the element were not there, so the event goes to whatever sits underneath.

The most common use is a decorative layer, such as a gradient overlay or a custom focus glow, that covers an interactive element but must not steal its clicks.

CSS
.overlay {
  pointer-events: none;
}

Try it

Letting clicks pass through an overlay

Both buttons look the same, but only the one under the pointer-events: none overlay receives your clicks.

Syntax

CSS
pointer-events: auto | none
/* SVG content only */
pointer-events: bounding-box | visiblePainted | visibleFill | visibleStroke
              | visible | painted | fill | stroke | all
  • Initial value: auto
  • Applies to: all elements
  • Inherited: yes
  • Animatable: no (it switches discretely)
  • Computed value: as specified

Values

Value Description
auto Normal behavior: the element can be the target of pointer events. For SVG it behaves like visiblePainted.
none The element is never the target. Events go to the element behind it, and it does not match :hover or :active from the pointer.
visiblePainted, visibleFill, visibleStroke, visible, painted, fill, stroke, all SVG-specific values that choose which parts of a shape (fill, stroke, visible or hidden parts) react. They have no effect on ordinary HTML boxes.

Usage notes

  • Children can opt back in. The property inherits, so pointer-events: none on a parent switches off the whole subtree, but a child with pointer-events: auto becomes clickable again. This is handy for a click-through layer with a few interactive controls on it.
  • It is not a way to disable things. pointer-events: none stops mouse and touch input only. A button or link can still be reached with the Tab key and activated with Enter or Space. To really disable a control, use the disabled attribute on form controls, or the inert attribute to take a whole region out of reach for every kind of input.
  • Screen readers are unaffected. The element stays in the accessibility tree, so assistive technology still sees and announces it.
  • Hover and cursor. An element with none does not show its own cursor, and it does not trigger its :hover styles. The element underneath gets both instead.
  • Text selection. Text inside an element with none can usually not be selected by dragging with the mouse. Use user-select to control selection explicitly.
  • Common use cases. Decorative overlays, tooltips that should not block the page, drag previews, and dimmed elements while a request is running. For the last case, also set aria-disabled or inert so keyboard users are treated the same way.

Browser support

Supported in all current browsers for HTML and SVG; the SVG-only values and bounding-box matter only in SVG.