Categories
CSS

How to disable HTML links with CSS?

Spread the love

To disable HTML links with CSS, we set the pointer-events property.

For instance, we write

<a class="disabled" href="#">...</a>

to add a link.

Then we write

a.disabled {
  pointer-events: none;
}

to disable the link with class disabled by setting the pointer-events property to none.

pointer-events: none; disables all mouse events.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

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