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
-
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
Related posts:
- How to center a div inside another div using CSS?
- How to change button color on hover in CSS?
- How to select all child except the first one in CSS?
- How to change the default text selection color using CSS?
- How to Set Width of an input Element using HTML & CSS?
- How to Change Background Color of an input Field using CSS?
- How to Remove Border From the Last Child using CSS?