CSS Layout How to - Create 3 column layout without using a table








Question

We would like to know how to create 3 column layout without using a table.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from  www . j a v a  2  s.co m-->
  border: 1px solid red;
}

#left {
  float: left;
}

#right {
  float: right;
}

#middle {
  overflow: hidden
}
</style>
</head>
<body>
  <div id="parent">
    <div id="left">
      test <br>test
    </div>
    <div id="right">
      test <br>test 
    </div>
    <div id="middle">
      test <br>test test <br>test test <br>test 
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: