【发布时间】:2022-01-19 22:48:47
【问题描述】:
我想要一个带有粘性标题和水平滚动的表格。
我不想在表格内垂直滚动。它应该随着页面滚动。所以没有设定桌子的高度。 这甚至可能吗?
这是不工作示例的代码笔: https://codepen.io/fwitkowski/pen/zYEQvvg
当我从表容器中删除溢出:自动时,位置粘性工作得很好。
.table-container {
max-width:350px;
overflow-x:auto; /* for horizontal scroll */
position: relative; /* relative to the normal flow */
border: solid 5px red /* for reference */
}
【问题讨论】:
标签: html css html-table sticky