HTML Element Style How to - Hover li element show image








Question

We would like to know how to hover li element show image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.lb-a-icon {<!--from  w w w  .j a v  a  2  s  .c o  m-->
  display: none;
}

.lb_li:hover .lb-a-icon {
  display: block;
}
</style>
</head>
<body>
  <ul>
    <li class="lb_li">
      <div class="lb-title">Label List 1</div>
      <div class="lb-a-icon">
        <img src="http://www.java2s.com/style/download.png">
      </div>
    </li>
    <li class="lb_li">
      <div class="lb-title">Label List 1</div>
      <div class="lb-a-icon">
        <img src="http://www.java2s.com/style/download.png">
      </div>
    </li>
  </ul>
</body>
</html>

The code above is rendered as follows: