Page Widget How to - Create Vertical layout menu without using breaking block elements








Question

We would like to know how to create Vertical layout menu without using breaking block elements.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#menu {<!--   ww w  . ja  v a  2s . c om-->
  width: 300px;
}

#menu a {
  display: block;
  background: #ccc;
  color: #000;
  padding: 10px 0;
  text-align: center;
  margin-bottom: 2px;
}
</style>
</head>
<body>
  <div id="menu">
    <a href="something1">Page 1</a> 
    <a href="something2">Page 2</a> 
    <a href="something3">Page 3</a>
  </div>
</body>
</html>

The code above is rendered as follows: