Page Widget How to - Hover menu background with Arrow








Question

We would like to know how to hover menu background with Arrow.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {<!--  ww  w.  ja  va  2  s  . com-->
  background-color: #EDEFE7;
  font-family: sans-serif;
}

li {
  position: relative;
  width: 430px;
}

li a {
  display: block;
  width: 415px;
  padding: 5px 0 5px 5px;
  color: #159867;
  text-decoration: none;
}

li a:hover, li a:focus {
  color: #EDEFE7;
  background-color: #159867;
}

li a:hover:after, li a:focus:after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  right: 0;
  background-color: #159867;
  -webkit-transform: rotate(45deg);
  -moz-transform: rotate(45deg);
  -ms-transform: rotate(45deg);
  -o-transform: rotate(45deg);
  transform: rotate(45deg);
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">Lorem</a></li>
    <li><a href="#">Ipsum</a></li>
    <li><a href="#">Dolor</a></li>
    <li><a href="#">Sit amet</a></li>
  </ul>
</body>
</html>

The code above is rendered as follows: