Both tables have a height of 50 pixels, and their contents do not overflow. But the table with the inscription is actually 70 pixels, because the title is not included in the calculation of the height of the table.
Can someone explain the rational lack of including a header in calculating table height?
This is the child from the table after all. And if you want to exclude it from the height of the table, you can only place the title outside the table, if you do not want it to be included.
.table { display: table; height: 50px; } .table-caption { display: table-caption; background-color: red; height: 20px; } .table-row { display: table-row; background-color: green; } .table-cell { display: table-cell; }
<div class="table"> <div class="table-row"> <div class="table-cell">table height is 50px</div> </div> </div> <br> <div class="table"> <div class="table-caption">caption</div> <div class="table-row"> <div class="table-cell">table height is 70px</div> </div> </div>
source share