我有一张桌子,需要一个标头进行垂直滚动。不带滚动的表如下所示:
Bu我滚动时遇到了这个问题:
在红色正方形中,您可以看到表格的主体位于标题的后面。如果我将border-top设置为0,则可以解决此问题,但是我需要表格具有该边框,我不想更改样式。
粘性标头技巧的主要css是这样的:
.tableFixHead {
overflow-y: auto;
height: 100px;
}
.tableFixHead thead th {
position: sticky;
top: 0;
}
.tableFixHead th {
background: white;
/*border-top: 0 !important;*/
}
.table-responsive-bold{
font-weight: bold;
}
我有这个小提琴来测试问题:https://jsfiddle.net/pmiranda/eaLv7qpn/1/
我还不得不将th
元素的背景色设置为白色。我从https://stackoverflow.com/a/47923622/3541320
有什么建议吗?
答案 0 :(得分:2)
答案 1 :(得分:0)