Page Widget How to - Create Arrows on hover








Question

We would like to know how to create Arrows on hover.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!--from   www  .  ja v  a 2 s .c  o  m-->
  width: 100px;
  height: 100px;
  background: #c0ffee;
}

.left, .right {
  width: 50px;
  height: 100px;
  position: absolute;
  line-height: 100px;
  color: #fff;
  text-align: center;
  font-size: 2em;
}

.left:hover, .right:hover {
  background: #000;
  opacity: 0.5;
}

.right {
  left: 58px;
}

.left:hover:before {
  content: "\2329";
}

.right:hover:before {
  content: "\232a";
}
</style>
</head>
<body>
  <div class="left"></div>
  <div class="right"></div>
  <img src="" />
</body>
</html>

The code above is rendered as follows: