可见在粘性标题后面的表格滚动

时间:2020-04-10 17:27:29

标签: html css angular sticky

我有一张桌子,我想使桌子的标题变粘。我的表中总共有5列。问题是,无论我添加了什么CSS,只有第4列和第5列都是粘性的。第一,第二和第三列的标题文本是固定的,并且背景滚动通过使表格的内容可见,滚动时导致标题文本和表格内容的重叠。

这是我的CSS课

grepl('[0-9]', x)

HTML代码:

.itemtable {
grid-area: toolbar;
justify-self: stretch;
border-bottom: 1px solid gainsboro;
height: 6.4vh;
overflow: hidden;
align-self : center;
background: whitesmoke
}

 thead tr th {
position: sticky;
top: 0;
}

table {
border-collapse: collapse;
}

th {
border-bottom: 1px solid #d5d5d5;
background: #eef2f4;
text-align: left;
}

我在做什么错?此问题仅在前3列出现,而后2列完全粘滞。

1 个答案:

答案 0 :(得分:0)

我能够坚持不懈地解决这个问题。由于某些奇怪的原因,它起作用。