我在一个HTML页面上创建了多个表。我已经使标题行具有粘性,以便只有里面的行可以滚动。然而,在滚动时,行中的一些数据会出现在粘性标题行的上方。这是我的css:
.table > :not(:first-child){
border-top: 0;
}
thead th {
position: sticky;
top: 0;
}
thead th:after {
content:'';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
border-bottom: 2px solid white;
}
类似于重叠的图像
您可以尝试更改
thead th {
position: sticky;
top: 0;
}
至:
thead th {
position: sticky;
top: -2px;
}
尝试使用:
table {
border-spacing: 0;
}
这为我解决了问题。