influxweb
3/30/2017 - 2:49 AM

How to disable HTML links with CSS? — First published in fullweb.io issue #92

How to disable HTML links with CSS? — First published in fullweb.io issue #92

How to disable HTML links with CSS?

Since IE11 we can just use CSS to prevent elements to fire hover and click event. Here is how to do it:

<a href="page.html" class="off">Link</a>
.off {
pointer-events: none;
cursor: default;
}

The CSS property disabling the link is pointer-events. When set to none, its elements won’t fire any hover or click event.

For a better user experience, it is also recommended to set cursor: default, so that no hand icon will appear when hovering the links or click-able elements.