Effect How to - Disable hover effect








Question

We would like to know how to disable hover effect.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.myElement {<!-- w w w .ja  va  2 s . c  o  m-->
  color: green;
  cursor: pointer;
}

.myElement:hover {
  color: red;
}

.myElement.disabled {
  color: green;
}
</style>
</head>
<body>
  <div class="myElement">normal</div>
  <div class="myElement disabled">disabled</div>
</body>
</html>

The code above is rendered as follows: