CSS Property Value How to - table-layout: fixed;








Question

We would like to know how to table-layout: fixed;.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.container {<!--from   w  w w.  j a v a 2 s . c  o  m-->
  border: 1px red solid;
  display: table;
  table-layout: fixed;
}

.containerRow {
  display: table-row;
}

.containerRow>div {
  display: table-cell;
  min-height: 200px;
  border: 1px green solid;
}

.col1 {
  width: 100px;
}

.col2 {
  width: 150px;
}

.col3 {
  width: 100px;
}
</style>
</head>
<body>
  <div class="container">
    <div class="containerRow">
      <div class="col1">This is column 1</div>
      <div class="col2">This is column 2</div>
      <div class="col3">This is column 3</div>
    </div>
  </div>
</body>
</html>

The code above is rendered as follows: