docs.rodeo

MDN Web Docs mirror

pointer-events

{{CSSRef}} 

The pointer-events CSS property sets under what circumstances (if any) a particular graphic element can become the target of pointer events.

{{EmbedInteractiveExample("pages/css/pointer-events.html")}} 

Syntax

/* Keyword values */
pointer-events: auto;
pointer-events: none;

/* Values used in SVGs */
pointer-events: visiblePainted;
pointer-events: visibleFill;
pointer-events: visibleStroke;
pointer-events: visible;
pointer-events: painted;
pointer-events: fill;
pointer-events: stroke;
pointer-events: bounding-box;
pointer-events: all;

/* Global values */
pointer-events: inherit;
pointer-events: initial;
pointer-events: revert;
pointer-events: revert-layer;
pointer-events: unset;

The pointer-events property is specified as a single keyword chosen from the list of values below.

Values

SVG only (experimental for HTML)

Description

When this property is unspecified, the same characteristics of the visiblePainted value apply to SVG content.

In addition to indicating that the element is not the target of pointer events, the value none instructs the pointer event to go “through” the element and target whatever is “underneath” that element instead.

Note that preventing an element from being the target of pointer events by using pointer-events does not necessarily mean that pointer event listeners on that element cannot or will not be triggered. If one of the element’s children has pointer-events explicitly set to allow that child to be the target of pointer events, then any events targeting that child will pass through the parent as the event travels along the parent chain, and trigger event listeners on the parent as appropriate. Of course any pointer activity at a point on the screen that is covered by the parent but not by the child will not be caught by either the child or the parent (it will go “through” the parent and target whatever is underneath).

Elements with pointer-events: none will still receive focus through sequential keyboard navigation using the Tab key.

Formal definition

{{cssinfo}} 

Formal syntax

{{csssyntax}} 

Examples

Disabling pointer events on all images

This example disables pointer events (clicking, dragging, hovering, etc.) on all images.

img {
  pointer-events: none;
}

This example disables pointer events on the link to http://example.com.

HTML

<ul>
  <li><a href="https://developer.mozilla.org">MDN</a></li>
  <li><a href="http://example.com">example.com</a></li>
</ul>

CSS

a[href="http://example.com"]
{
  pointer-events: none;
}

Result

{{EmbedLiveSample("Disabling_pointer_events_on_a_single_link", "500", "100")}} 

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN