html - Disable a link using css

Method 1

You can set href attribute to javascript:void(0)
<style>
.disabled{
    /*Disabled link style*/
    color:black;
}
</style>

<a class="disabled" href="javascript:void(0)">LINK</a>

Method 2
For more visibility, I am copying this solution here:
<a href="link.html" class="not-active">Link</a>

.not-active {
   pointer-events: none;
   cursor: default;
}
For browser support, please see: http://caniuse.com/#search=pointer-events*, if you need to support IE there is a workaround, see this answer.
Warning: The use of pointer-events in CSS for non-SVG elements is experimental. The feature used to be part of the CSS3 UI draft specification but, due to many open issues, has been postponed to CSS4.*
Share on Google Plus

About Amit

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment