disable click css code example

Example 1: disable click css

.avoid-clicks {
  pointer-events: none;
}

Example 2: css disable button click

button.disabled{
  pointer-events: none;
}

Example 3: how to disable a link

<style>
.isDisabled {
  color: currentColor;
  cursor: not-allowed;
  opacity: 0.5;
  text-decoration: none;
}
</style>
<a class="isDisabled" href="https://unfetteredthoughts.net">Disabled Link</a>

Example 4: html disable anchor link

a.isDisabled {
  pointer-events: none;
}

Example 5: disable right click with css

document.oncontextmenu = new Function("return false;");

Tags: