我正在尝试在不使用Javascript的情况下获得一个固定的表头。下面是我的表的基本设置:
<table>
<thead>
<tr>
<th>...</th>
<th>...</th>
<th>...</th>
<tr>
</thead>
<tbody>
...
</tbody>
</table>
我试过使用css,但没有成功。我得到了一个固定的标题,但它的宽度很小,它不能调整。
.thead {
position:fixed;
top:0;
width:100%;
}
发布于 2017-04-26 14:47:26
尝尝这个
<table>
<thead class="fixedthead">
<tr>
<th>...</th>
<th>...</th>
<th>...</th>
<tr>
</thead>
<tbody>
...
</tbody>
</table>
.fixedthead{position:fixed; top:0px;}
https://stackoverflow.com/questions/43625367
复制相似问题