【发布时间】:2011-07-10 04:34:35
【问题描述】:
如果给定最大高度,如何使包含子/嵌套表的表可滚动?我不希望标题随之滚动。我真正在寻找的是一些可以将我的 s 包装在其中的有效标签,或者其他一些与 this 一样有效的标记:
<table>
<thead>
<tr>
<th>Column1</th>
<th>Column2</th>
</tr>
</thead>
<!-- Insert valid tag here to wrap <tbody>s -->
<tbody>
<tr>
<td>Val1</td>
<td>Val2</td>
</tr>
<tr class="sub-table">
<td colspan="2">
<table>
<thead>
<tr>
<th>Sub Column1</th>
<th>Sub Column2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sub Val1</td>
<td>Sub Val2</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
<tbody>
<tr>
<td>Val1</td>
<td>Val2</td>
</tr>
<tr class="sub-table">
<td colspan="2">
<table>
<thead>
<tr>
<th>Sub Column1</th>
<th>Sub Column2</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sub Val1</td>
<td>Sub Val2</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
<!-- Insert valid close tag here -->
</table>
【问题讨论】:
-
您是希望嵌套表的 TBODY 滚动,但嵌套表的 THEAD 保持固定,还是应该只有主表的 THEAD 保持固定?
标签: html html-table nested