我有一个包含两个标题行的表 Demo .
<thead>
<tr>
<th colspan="4"><big>Variable Details</big></th>
</tr>
<tr>
<th>Variable Name</th>
<th>Starting Value</th>
<th>Default Value</th>
<th>Description</th>
</tr>
</thead>
我想卡住前两个标题行(表格的标题部分)。有什么想法。
最佳答案
将 CSS 属性位置更改为“粘性”以获得粘性表格头。见下文。
CSS:
thead { 位置:粘性;顶部:0px; z 索引:10; }
注意:您可能需要根据其他 CSS 属性调整 z-index。
关于javascript - 如何卡住表的 head 部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18848369/