CSS Property Value How to - Create table into div








Question

We would like to know how to create table into div.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.container {<!--from   w w  w. ja v  a  2  s  . co  m-->
  width: 800px;
}

.col-2, .col-4 {
  float: left;
}

.col-4 {
  width: 400px;
}

.col-2 {
  width: 200px;
}
</style>
</head>
<body>
  <div class="container">
    <div class="col-4">1</div>
    <div class="col-4">1</div>
    <div class="col-2">1</div>
    <div class="col-2">1</div>
    <div class="col-2">1</div>
    <div class="col-2">1</div>
  </div>
</body>
</html>

The code above is rendered as follows: