Page Widget How to - Build Horizontally Evenly Distributed Menu








Question

We would like to know how to build Horizontally Evenly Distributed Menu.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
a {<!--from  ww  w  .  ja  va  2 s .  c om-->
  text-decoration: none;
}

.navbar ul {
  list-style-type: none;
  margin: 0px;
  padding: 0px;
  text-align: center;
}

.navbar li {
  display: inline-block;
  width: 20%;
  white-space: nowrap;
  background-color: silver;
}
</style>
</head>
<body>
  <div class="navbar">
    <ul>
      <li><a href="Nietzsche">Nietzsche</a></li>
      <li><a href="Heidegger">Heidegger</a></li>
      <li><a href="Wittgenstein">Wittgenstein</a></li>
      <li><a href="Foucault">Foucault</a></li>
    </ul>
  </div>
</body>
</html>

The code above is rendered as follows: