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.

Responsive Sidebar Menu with CSS and JavaScript Cool CSS Button with Hover Animation Pure CSS Custom Radio Buttons Custom Emoji Radio Buttons with CSS Color Picker Design with HTML CSS and JavaScript Custom Radio Buttons with CSS Engraved HTML Buttons With CSS Neumorphic Buttons Design with CSS Cool Profile Card Design with HTML 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 Simple Price Range Slider With HTML CSS and JavaScript Profile Card With Hover Effect using HTML and CSS Circle With Two Colors using CSS Simple FAQ Accordion With HTML CSS and JavaScript