Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/378.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 多表头时如何制作表的粘性表头_Javascript_Html_Css_Forms_Meteor - Fatal编程技术网

Javascript 多表头时如何制作表的粘性表头

Javascript 多表头时如何制作表的粘性表头,javascript,html,css,forms,meteor,Javascript,Html,Css,Forms,Meteor,我想把桌子的头粘上。但它似乎不起作用。我一直在用meteor框架做这个实验 <table class="tableclass"> <thead class="headclass"> <tr class="tr"> <th style

我想把桌子的头粘上。但它似乎不起作用。我一直在用meteor框架做这个实验

                         <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;
}