Tables to be used for tabular data. Divs to be used for layout. This is what I get out of this thread.
.table {
display: table;
padding: 5px;
}
.tr {
display: table-row;
padding: 5px;
}
.td {
display: table-cell;
padding: 5px;
width: 150px;
border: #000000 solid 1px;
margin: 5px;
}
<div class="table">
<div class="tr">
<div class="td">Row 1,
<br />Column 1</div>
<div class="td">Row 1, Column 2</div>
<div class="td" style="background:#888888;"></div>
</div>
<div class="tr">
<div class="td">Row 2,
<br />Column 1</div>
<div class="td" style="background:#888888;"></div>
</div>
</div>
But the first most 'layout feature' I'm looking for relates to table's colspan
, rowspan
.
How can I implement the same behavior using divs?