HTML Element Style How to - Hover to show a div








Question

We would like to know how to hover to show a div.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.sten {<!--from w ww . j  a v  a2s . co m-->
  display: none;
}

div:hover+div.sten {
  display: block;
}
</style>
</head>
<body>
  <div>
    <a class="per">Hover over me!</a>
  </div>
  <div class="sten">Stuff shown on hover</div>
</body>
</html>

The code above is rendered as follows: