Disable HTML Link using CSS

In this tutorial we will see how to Disable HTML Link using CSS. CSS pointer-events property and CSS opacity property are used to disable the link completely.

HTML Code

Simple HTML Code is given below, In this code we have HTML link element inside the main body of html document.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Disable HTML Link using CSS</title>  
</head> 
<body>

<a href="https://www.howtocodeschool.com/">HowToCodeSchool.com</a>
    
</body>
</html>

CSS pointer-events Property

CSS pointer-events property defines whether or not an element should react to the mouse cursor or pointer events. You can also specify how an element should react on pointer event.

The CSS pointer-events Property can have four possible values assigned to it, auto, none, initial and inherit.

CSS pointer-events Property is supported by all major browsers.

CSS Code

CSS code is given below, in this code we have just used pointer-events property to disable our main link and we also changed it's opacity to 50%, so that it also looks disabled.

a {
  text-decoration: none;
  pointer-events: none;
  opacity: 0.5;
}

Demo

Video Tutorial

Watch video tutorial on Disable HTML Link using CSS.

Neumorphic Search Bar Design with HTML and CSS Simple Login Form with Placeholder Animation Pure CSS Button with Folded Corner Background Color Change Slider with HTML CSS and JavaScript 404 Page Not Found Template Design with HTML and CSS Movies Blog Card Design with HTML and CSS Simple CSS Border Animation with before and after Selector Custom Social Select Dropdown Menu with CSS and JavaScript Facebook Offline and Online Notification with CSS and JS New Year 2022 Text Animation with CSS and JS Change Placeholder Color using CSS Custom Select Tag DropDown with CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Simple Price Range Slider With HTML CSS and JavaScript Circle With Two Colors using CSS Card With Ribbon using HTML and CSS Simple Loading Screen using HTML and CSS Disable Textarea Resizable Property using CSS Button like Links using CSS Simple Dropdown Menu Using HTML and CSS Background Color Transition using CSS Highlight Required Input Fields using CSS Disable HTML Link using CSS Difference Between Descendant Selector and Child Selector How To Change Color and Size of Hr Tag Using CSS How To Center Align HTML Table Convert Checkbox To Toggle Button Using CSS Drawing Stars using HTML and CSS Button Bounce Effect using CSS Image as Text Background using CSS background-clip Property Vertically Rotate HTML Element using CSS Vertical Align Middle using CSS Text Over Image Hover Effect - Css Hover Simple CSS Button Hover Effect using Before Selector