Page Widget How to - Create div based left menu bar








Question

We would like to know how to create div based left menu bar.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from  w w  w.  j a va2s. c o m-->
  font-family: Arial;
  background: #99DA5E;
  margin: 5px 0;
  padding: 1%;
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 17px;
  color: #252525;
}

span {
  float: left;
  font-family: Arial;
  background: #FAFA41;
  margin: 5px 0;
  padding: 1%;
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  height: 17px;
  color: #505050;
}
</style>
</head>
<body>
  <div>apple</div>
  <div>jack fruit</div>
  <div>super puper long title for fruit</div>
  <div>watermelon</div>
  <span>should look like this...</span>
</body>
</html>

The code above is rendered as follows: