CSS Layout How to - Add divider to two column layout








Question

We would like to know how to add divider to two column layout.

Answer


<!--  w  w  w  .jav a2  s  . c  o  m-->
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
body {
  height: 1200px;
}

#content-wrapper {
  width: 100%;
  height: 100%;
  background: blue;
}

#header {
  background: black;
  color: white;
  height: 50px;
}

#menu {
  float: left;
  width: 200px;
  color: white;
  height: 100%;
}

#content {
  margin-left: 200px;
  background: green;
  color: white;
  height: 100%;
  border-left: 5px solid red;
}
</style>
</head>
<body>
<html>
<body>
  <div id="header">header</div>
  <div id="content-wrapper">
    <div id="menu">menu</div>
    <div id="content">
      content <br /> content <br /> content <br /> content <br />
      content <br /> content <br /> content <br /> content <br />
      content <br /> content <br /> content <br /> content <br />
      content <br /> content <br /> content <br /> content <br />
      content <br /> content <br /> content <br /> content <br />
      content <br /> content <br /> content <br />
    </div>
  </div>
</body>
</html>
</body>
</html>

The code above is rendered as follows: