Javascript 多表头时如何制作表的粘性表头
我想把桌子的头粘上。但它似乎不起作用。我一直在用meteor框架做这个实验Javascript 多表头时如何制作表的粘性表头,javascript,html,css,forms,meteor,Javascript,Html,Css,Forms,Meteor,我想把桌子的头粘上。但它似乎不起作用。我一直在用meteor框架做这个实验 <table class="tableclass"> <thead class="headclass"> <tr class="tr"> <th style
<table class="tableclass">
<thead class="headclass">
<tr class="tr">
<th style="color: #ffffff">th content</th>
{{#each names}}
<th>{{name}}</th>
{{/each}}
</tr>
</thead>
{{#each peoples}}
<thead>
<tr class="tr-another">
<th colspan="100%">
<span id="report"><img id="icons" src="button.svg" width="16px" height="16px">
</span> {{this}}</th>
</tr>
</thead>
<tbody class={{this}}>
{{>Field}}
</tbody>
{{/each}}
</table>
有人能帮忙吗。我想让第一个茶黏黏的
谢谢。我想你应该:
.headclass {
position: sticky;
top: 0;
}
根据您不能设置位置:粘滞代码>在
或
上。但是你可以粘贴一个
。这很奇怪,但很管用
您可以在类.outer表th
上设置此属性。但是我没有在你的HTML中看到这个类
实际上,根据您的HTML代码,您可以编写以下代码:
。头等舱th{
位置:粘性;
排名:0;
}
这里有几个问题:1)表可能只有一个
,您的示例有多个。但是
可能有多行。2) 样式应该有.tableclass
,但是您的样式没有点。先把它修好。检查一下这场闪电战。它有基于您的代码的工作示例
.headclass {
position: sticky;
top: 0;
}