How to disable a link using only CSS?

How to disable a link using only CSS - غیر فعال کردن لینک با استفاده از css

How to disable a link using only CSS?

You can simply use the CSS pointer-events property to disable a link. The none value of this property specify the element is never the target of pointer events.

Let’s try out the following example to understand how it actually works:


<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>Disable a Link using only CSS</title>
        cursor: default;
        pointer-events: none;        
        text-decoration: none;
        color: grey;
    <a href="somepage.html" class="disabled-link">HTML Link</a>

The pointer-events property supported in all major browsers, such as Chrome, Firefox, Safari, IE11+, etc. also, you can use jQuery to remove the clickable behavior from a disabled link.


Leave a Reply

Your email address will not be published. Required fields are marked *