Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

CSS pointer-events property

CSS pointer-events property

Example

Set whether an element reacts to mouse events:

div

.ex1

{

pointer-events:

none

;

}

div

.ex2

{

pointer-events:

auto

;

}

Try it »


Definition and usage

The pointer-events property is used to set whether an element reacts to mouse events.

Default value: none
Default value: auto
Inherited: None
Animatable: no. Read animatable
Version: CSS3
JavaScript syntax: object.style.all="initial"      Try it

Browser support

The numbers in the table indicate the lowest browser version that supports the property.

property
pointer-events 2.0 11.0 3.6 4.0 9.0

CSS Syntax

pointer-events: auto|none;


Attribute values

Attribute values Description
auto Default value. With this property set, links can be clicked and accessed normally.
none The element cannot react to mouse events
initial Set this property to its default value,See moreinitial
inherit Inherit this property from the parent element, See more inherit

Example

/* Property values */

pointer-events

:

auto

;

pointer-events

:

none

;

pointer-events

:

visiblePainted

;

/* Only applies to SVG */

pointer-events

:

visibleFill

;

   

/* Only applies to SVG */

pointer-events

:

visibleStroke

;

 

/* Only applies to SVG */

pointer-events

:

visible

;

       

/* Only applies to SVG */

pointer-events

:

painted

;

       

/* Only applies to SVG */

pointer-events

:

fill

;

         

/* Only applies to SVG */

pointer-events

:

stroke

;

       

/* Only applies to SVG */

pointer-events

:

all

;

           

/* Only applies to SVG */

/* global values */

pointer-events

:

inherit

;

pointer-events

:

initial

;

pointer-events

:

unset

;

visiblePainted

Only applies to SVG. An element becomes the target of mouse events only under the following conditions:

visibleFill

Only applies to SVG. An element becomes the target of mouse events only when its visibility property is visible and the mouse pointer is inside the element; the value of the fill property does not affect event handling.

visibleStroke

Only applies to SVG. An element becomes the target of mouse events only when its visibility property is visible and the mouse pointer is on the element's boundary; the value of the stroke property does not affect event handling.

visible

Only applies to SVG. An element becomes the target of mouse events only when its visibility property is visible and the mouse pointer is inside or on the boundary of the element; the values of the fill and stroke properties do not affect event handling.

painted

Only applies to SVG. An element becomes the target of mouse events only under the following conditions:

The value of the visibility property does not affect event handling.

fill

Only applies to SVG. An element becomes the target of mouse events only when the mouse pointer is inside the element; the values of the fill and visibility properties do not affect event handling.

stroke

Only applies to SVG. An element becomes the target of mouse events only when the mouse pointer is on the element's boundary; the values of the stroke and visibility properties do not affect event handling.

all

Only applies to SVG. An element becomes the target of mouse events only when the mouse pointer is inside or on the boundary of the element; the values of the fill, stroke, and visibility properties do not affect event handling.