CSS Layout How to - Align anchor evenly in the same line








Question

We would like to know how to align anchor evenly in the same line.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.links {<!--from   w w w  .  j  a v  a2 s . c  o  m-->
  width: 100%;
}

.links>a {
  float: left;
  display: inline-block;
  width: 20%;
  padding: 0;
  margin: 0;
  color: #fff;
  background-color: #4C8331;
}
</style>
</head>
<body>
  <div class="links">
    <a href="#">Previous</a> <a href="#">Current</a> <a href="#">Next</a>
    <a href="#">01/01/2011</a> <a href="#">01/08/2011</a>
  </div>
</body>
</html>

The code above is rendered as follows: