To disable a link using CSS, pointer-events property can be used, which sets whether the element in the page has to respond or not while clicking on elements. The pointer-events property is used to specify whether element show to pointer events and whether not show on the pointer.
Below example illustrate the approach:
Example 1: Below code shows the use of property-events where ‘a’ tag is disabled, with no cursor (disabled cursor pointer on ‘a’ tag)
<!DOCTYPE html> <html> <head> <title>Disable Link using CSS</title> <style type="text/css"> .not-active { pointer-events: none; cursor: default; } </style> </head> <body> <center> <h1 style="color: green;">GeeksforGeeks</h1> <h3>A Computer Science Portal for Geeks</h3> <b>Disabled link:</b> To visit us <a href="www.geeksforgeeks.org" class="not-active">Click Here</a> <br> <br> <b>Enabled link:</b> To use our ide <a href= Click Here</a> </center> </body> </html> |
Output: We can notice that although it looks like a link, nothing happens when we take pointer on it or click on it.

Example 2: This code shows CSS which applies to an ‘a’ tag so that it looks like, that the link is disabled, to do so, color and text-decoration property can be used.
<!DOCTYPE html> <html> <head> <title>Disable Link using CSS</title> <style type="text/css"> .not-active { pointer-events: none; cursor: default; text-decoration: none; color: black; } </style> </head> <body> <center> <h1 style="color: green;">GeeksforGeeks</h1> <h3>A Computer Science Portal for Geeks</h3> <b>Disabled link:</b> To visit us <a href="www.geeksforgeeks.org" class="not-active"> Click Here </a> <br> <br> <b>Enabled link:</b> To use our ide Click Here </a> </center> </body> </html> |
Output: Here it can be seen that it does not even look like a link.

Recommended Posts:
- How to disable text selection highlighting using CSS?
- How to disable resizable property of textarea using CSS?
- How to disable zoom on a mobile web page using CSS?
- Difference between Hard link and Soft link
- How to disable a CSS :hover effect?
- How to disable right click on web page using JavaScript ?
- How to disable HTML links using JavaScript / jQuery ?
- How to disable scrolling temporarily using JavaScript?
- How to disable scroll to change number in <input type="number"> field using JavaScript/jQuery?
- How to disable dragging an image from an HTML page using JavaScript/jQuery ?
- How to enable/disable all input controls inside a form element using jQuery ?
- How to disable arrow key in textarea using JavaScript ?
- How to disable Copy, Paste, Cut and Right Click using jQuery ?
- How to disable scrollbar without hiding using jQuery ?
- How to disable form submit on enter button using jQuery ?
- How to disable the modification of text canvas using Fabric.js ?
- How to make sure clients have enough words in textarea by using angularjs in order to disable/enable a button?
- How to disable selectability of a canvas circle using Fabric.js ?
- CSS | :link Selector
- CSS :any-link Selector
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

