CSS propertyInteraction and more
pointer-events
Stops an element from reacting to clicks and hovering.
- Initial value
auto- Inherited
- Yes
- Animatable
- no
- Applies to
- all elements
- JavaScript
element.style.pointerEvents = "none"
Example
#CSS
.glow {
position: absolute;
inset: 0;
background: radial-gradient(circle at top, rgba(167, 139, 250, 0.3), transparent 60%);
pointer-events: none;
}Example HTML
<div style="position: relative; padding: 20px; border-radius: 12px; border: 1px solid #333;">
<a href="#" style="color: #c4b5fd;">The link under the glow is clickable</a>
<div style="position: absolute; inset: 0; border-radius: 12px; background: radial-gradient(circle at top, rgba(167,139,250,.3), transparent 60%); pointer-events: none;"></div>
</div>Preview
Definition and usage
#The pointer-events: none property makes an element “transparent” to mouse and touch. Clicks pass through it to the elements underneath, and :hover styles stop working.
It is most often used for decorative overlays, gradients, and glows that sit above content but shouldn’t block clicking the links beneath them.
Note: pointer-events: none does not disable keyboard handling. A button with this property can still be focused with the Tab key and activated with Enter, so use the disabled attribute to block actions.
Syntax
#Syntax
pointer-events: auto | none;Values
#Values in practice
#auto
The overlay captures clicks, the button beneath it doesn’t work.
.demo { pointer-events: auto; }none
Clicks pass through the overlay to the button.
.demo { pointer-events: none; }Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- Always mark decorative layers above content with
pointer-events: none, otherwise they will block clicking. - Use
disabledto turn buttons off, notpointer-events: nonealone, because the keyboard will still work.
Related entries
#Practise it in lessons
#Spotted a mistake or missing an example? Write to us.