Prevent hyperlink events from CSS3

Updated: Mar 25



Ever wondered if it possible to prevent a hyperlink from executing (i.e.) launch a new web page, a new window, display a HTML page, or simply prevent anything from happening when a link is clicked? It is possible using CSS3. All you have to do is add the following CSS3 declaration for the anchor <a> tag.


a
{
pointer-events: none;
cursor:default;
} 

This prevents any link from being executed. If there are pre-defined classes, styles then you can always add the !important to the styles. See example below.



a
{
pointer-events:none !important;
cursor:default !important;
} 

That’s it. The functionality is on its way!

#CSS3 #Coding

2 views
  • White Facebook Icon
  • Twitter
  • LinkedIn

© 2020 by ForNextCo.

Contact: Mani@ForNextCo.com