Effect How to - Hover to show element








Question

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

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#image, #btnPrev {<!--from   w  w w .  j av a2 s  .  com-->
  position: Absolute;
  top: 0;
  left: 0;
  height: 50px;
  width: 50px;
  background: Red;
}

#btnPrev {
  background: blue;
  display: none;
}

#image:hover+#btnPrev, #btnPrev:hover {
  display: block;
}
</style>
</head>
<body>
  <div id="image"></div>
  <div id="btnPrev"></div>
</body>
</html>

The code above is rendered as follows: