[CSS] Pointer-events
The
Note:
- pointer-event: none: The element is never the target of mouse events; however, mouse events may target its descendant elements if those descendants have
- The prime use case for
Ex: https://codepen.io/anon/pen/mBQPjX
pointer-events
property allows for control over how HTML elements respond to mouse/touch events – including CSS hover/active states, click/tap events in Javascript, and whether or not the cursor is visible.The three valid values for any HTMl element are:none
prevents all click, state and cursor options on the specified HTML element
auto
restores the default functionality (useful for use on child elements of an element withpointer-events: none;
specified
inherit
will use thepointer-events
value of the element's parent
Note:
- pointer-event: none: The element is never the target of mouse events; however, mouse events may target its descendant elements if those descendants have
pointer-events
set to some other value. In these circumstances, mouse events will trigger event listeners on this parent element as appropriate on their way to/from the descendant during the event capture/bubble phases.- The prime use case for
pointer-events
is to allow click or tap behavior to “pass through” an element to another element below it on the Z axis. For example, this would be useful for graphic overlays, or hiding elements with opacity
(eg. tooltips) and still allowing text-selection on the content below it.Ex: https://codepen.io/anon/pen/mBQPjX
Comments
Post a Comment