Page Widget How to - Align menu items with arrow to right








Question

We would like to know how to align menu items with arrow to right.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul {<!--from w w w .j a  v  a 2s  .co  m-->
  float: right;
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 300px;
}

ul li a {
  float: left;
  width: 300px;
}

ul li {
  float: left;
  width: 300px;
  height: 50px;
  line-height: 50px;
  text-indent: 10%;
  background: grey;
  margin-bottom: 10px;
  border: 1px solid black;
  position: relative;
}

ul li:before {
  content: "";
  position: absolute;
  top: 0;
  left: 1px;
  margin-top: -1px;
  border-top: 26px solid transparent;
  border-bottom: 26px solid transparent;
  border-right: 21px solid black;
  margin-left: -22px;
}

ul li:after {
  content: "";
  position: absolute;
  top: 0;
  left: -19px;
  border-top: 25px solid transparent;
  border-bottom: 25px solid transparent;
  border-right: 20px solid grey;
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">Production</a></li>
    <li><a href="#">More</a></li>
    <li><a href="#">Another Nav</a></li>
    <li><a href="#">Test</a></li>
    <li><a href="#">A Test Navigation</a></li>
  </ul>
</body>
</html>

The code above is rendered as follows: