Prevent hyperlink events from CSS3

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!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: