两个表的高度都设置为50px,其内容不会溢出.但是带有标题的表实际上是70px,因为标题似乎没有包含在表的高度计算中.
毕竟,这是桌子的孩子.如果你想将它从表格高度中排除,如果你不想包含它,可以在表格外放置标题.
.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; }
@H_404_12@
@H_404_12@最佳答案