我有多个表格在一个页面上,我想要的标题是粘性的。 这是我的小提琴:JSFiddle 下面是涉及div包装器和表头的CSS: .scroll {
overflow: auto;
max-height: 300px;
position: relative;
}
.headclass th{
position: sticky;
top: 0;
} I tried to follow this answer, but can't get it working on my fiddle
我把一张桌子分成表头和表体。为了让桌面看起来更漂亮,桌面头部有一个两部分的背景图像,使其具有圆角。表头没有边框。
表体有边框。因此,它看起来稍微突出了一点,超出了左右的桌面头部。
我想让表头(无边框)与表体(有边框)的大小相同。对于如何实现这一点有什么想法吗?
HTML:
<table id="outerTable">
<!-- No border -->
<!-- Smaller than tbody on right and left -->
<thead>