CSS Property Value How to - display: table-cell; Make Even column heights without using a TABLE








Question

We would like to know how to display: table-cell; Make Even column heights without using a TABLE.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
div {<!--from   w w w  .ja v a 2  s  . c  o m-->
  display: table-cell;
  background: #FF0;
}

div:first-child {
  background: #F00;
}
</style>
</head>
<body>
  <div>This is a column</div>
  <div>
    This is a column<br /> 
    That isn't the same<br /> 
    height at the other<br />
    yet the background<br /> still works
  </div>
</body>
</html>

The code above is rendered as follows: