【发布时间】:2012-01-04 04:27:24
【问题描述】:
我正在编写一个页面,我需要一个 html 表格来保持设定的大小。我需要表格顶部的标题始终保持在那里,但无论向表格中添加多少行,我还需要表格的主体滚动。
我希望它看起来像这个网址中的方法 2:http://www.cssplay.co.uk/menu/tablescroll.html
我试过这样做,但没有出现滚动条:
tbody {
height: 80em;
overflow: scroll;
}
<table border=1 id="qandatbl" align="center">
<tr>
<th class="col1">Question No</th>
<th class="col2">Option Type</th>
<th class="col1">Duration</th>
</tr>
<tbody>
<tr>
<td class='qid'></td>
<td class="options"></td>
<td class="duration"></td>
</tr>
</tbody>
</table>
【问题讨论】:
-
为什么不使用示例方法中的代码?很遗憾,你不能使用
<tbody>。
标签: html css scroll html-table overflow