我有 HTML 表格及其 CSS。
CSS:
#outerDIV {
position: relative;
padding-top: 20px;
}
#innerDIV {
overflow-y: auto;
height: 500px;
}
table#mytable tbody tr:first-child
{
width:100%;
position :absolute;
}
HTML:
<div class="outerDIV">
<div class="innerDIV">
<table id="#mytable"></table>
</div>
</div>
我需要表的固定标题标签,上面的代码也是如此,但是第 th 个标签的宽度被压缩到左侧并且与正文的 tr
的宽度不匹配.如何使 tr 达到 100% 宽度?
最佳答案
切勿尝试在 <tr>
上使用绝对甚至相对重新定位, <td>
和 <th>
.它不适用于表格,并且在大多数情况下,结果与您的预期相去甚远。
关于javascript - html css tr 设置宽度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30273558/