How to make an HTML anchor tag not clickable/linkable using CSS?

Spread the love

Sometimes, we want to make an HTML anchor tag not clickable/linkable using CSS.

In this article, we’ll look at how to make an HTML anchor tag not clickable/linkable using CSS.

How to make an HTML anchor tag not clickable/linkable using CSS?

To make an HTML anchor tag not clickable/linkable using CSS, we set te pointer-events property.

For instance, we write

<a style="" href="page.html" class="inactiveLink">page link</a>

to add a link.

Then we write

.inactiveLink {
  pointer-events: none;
  cursor: default;
}

to add pointer-events: none; to make the link not clickable.

Conclusion

To make an HTML anchor tag not clickable/linkable using CSS, we set te pointer-events property.

Leave a Reply

Your email address will not be published.