.flex {
display: flex;
width: 90%;
margin: 0 auto;
justify-content: space-between;
}
table {
width: 48%;
border-collapse: collapse;
}
th, td {
border: 1px solid gray;
padding: 5px;
}
<div class="flex">
<table>
<tbody>
<tr>
<th>1st Table</th>
</tr>
<tr>
<td>
<p>
I want to be <br>
the same height<br>
as the next table
</p>
</td>
</tr>
</tbody>
</table>
<table>
<tbody>
<tr>
<th>2nd Table</th>
</tr>
<tr>
<td>
<p>
This text has 4 lines<br>
This text has 4 lines<br>
This text has 4 lines<br>
This text has 4 lines
</p>
</td>
</tr>
</tbody>
</table>
</div>
我想,以配合无名高地表中最高的表,但我该怎么办呢?
在div的情况下,“align-items:stretch”没有问题。
我试过“align-items:stretch;”,但高度并没有改变。 如果可能的话,我想通过“td”扩展“th”的高度而不改变它的高度,但是我必须使用JavaScript吗?
感谢您详细的解答! 我明白CSS 3中Table标签的行为是“不确定的”,它会通过添加一个包装来“确定地”移动它。 – chatii