<tr> / <td>高度被忽略?

时间:2020-01-31 07:37:46

标签: css html-table

我正在尝试制作一个具有固定布局的表格:每个单元格都有一个预定义的高度,如果单元格内有额外的信息,那么应该有一个滚动条。提前声明每个单元格的高度非常重要。但是,据我所知,它完全忽略了行和单元格高度上的(非常强调的)方向。它不断为<tr><td>添加额外的空间,以确保它可以显示全部内容。如何使其停止?

<table border="1" style="table-layout:fixed; height:400px; width:500px;">
    <tr style="height:50px; min-height:50px; max-height:50px;">
        <td style="height:50px; min-height:50px; max-height:50px; overflow-y:scroll;">
            <div style="height:500px; background-color:#fdc;">abc<br/>abc<br/>abc<br/>abc</div>
        </td>
    </tr>
    <tr style="height:350px; min-height:350px; max-height:350px;">
        <td style="height:350px; min-height:350px; max-height:350px; overflow-y:scroll;">
            <div style="height:200px; background-color:#cdf;">abc<br/>abc<br/>abc<br/>abc</div>
        </td>
    </tr>
</table>

谢谢。

0 个答案:

没有答案