【发布时间】:2021-06-07 11:28:58
【问题描述】:
我有一个垂直滚动的表格。 我将一些行折叠起来并由一些脚本管理。
<html lang="en">
<head>
<style type="text/css">
table { border: 1px solid black;
border-collapse: collapse;
overflow-y: scroll;
display: inline-block; }
tr td { border: 1px solid black; }
tr.hide { visibility: collapse;}
</style>
</head>
<body>
<table>
<tr><td> Uno </p></td></tr>
<tr class="hide"><td> Due </p></td></tr>
<tr><td> Tre </p></td></tr>
<tr class="hide"><td> Quattro </p></td></tr>
</table>
</body>
</html>
为了允许额外的内容,我使用了overflow-y: scroll 和display: inline-block,但是由于隐藏的内容,这会在表格的最后一行之后创建一个空格。表格大小正确,但即使没有溢出,也会显示滚动条(滚动空白)。
我在 Chrome 和 Firefox 中看到了这一点。
关于如何使这些行真正不可见有什么想法吗?
【问题讨论】:
标签: html css html-table scroll visibility