HTML Element Style How to - Hover to unshade image








Question

We would like to know how to hover to unshade image.

Answer


<!DOCTYPE html>
<html lang="en">
<head>
<style type="text/css">
ul {<!--  ww  w .  j a  va2s .c  o m-->
  padding: 0;
  list-style: none;
}

ul li {
  float: left;
  margin: 10px;
}

ul li img {
  opacity: 0.5;
  display: block;
  filter: alpha(opacity = 50); /* to work in IE */
}

ul li img:hover {
  opacity: 1;
  filter: alpha(opacity = 100); /* to work in IE */
}
</style>
</head>
<body>
  <ul>
    <li><img src="http://www.java2s.com/style/download.png" alt="Club Card"></li>
    <li><img src="http://www.java2s.com/style/download.png" alt="Diamond Card"></li>
    <li><img src="http://www.java2s.com/style/download.png" alt="Spade Card"></li>
    <li><img src="http://www.java2s.com/style/download.png" alt="Heart Card"></li>
  </ul>
</body>
</html>

The code above is rendered as follows: