Easiest way to disable a link using CSS

The easiest way to disable a link in CSS is to use the pointer-events property. The pointer-events property controls various mouse events on an element.

To disable a link using pointer-events property, simply apply pointer-events: none; on the link that you want to make disabled. Also, you can set the text-decoration property to line-through so that the user can get an idea that this link is disabled.

Here is a working example:

Example:

a{
    pointer-events: none;
    text-decoration: line-through;
}

Author

  • Manoj Kumar

    Hi, My name is Manoj Kumar. I am a full-stack developer with a passion for creating robust and efficient web applications. I have hands-on experience with a diverse set of technologies, including but not limited to HTML, CSS, JavaScript, TypeScript, Angular, Node.js, Express, React, and MongoDB.

    View all posts