What to do when pointer-events: none; does not work in anchor tags

pointer-events: none; is a CSS property that controls the presence or absence of pointer events (click, touch, mouse-down, etc.) on HTML elements. However, when this property is applied to an anchor tag ( <a>), it may not have the desired effect.

In such cases, try setting display: block; ordisplay: inline-block; on the anchor tag. In many cases, this will allow pointer-events: none; to function properly.

This is because anchor tags are inline elements by default, and setting pointer-events on top of an inline element may not result in the expected behavior. This behavior depends on the browser implementation and rendering engine.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top