gpt4 book ai didi

html - 使用 CSS 卡住表头时表头和正文未正确对齐

转载 作者:太空宇宙 更新时间:2023-11-04 15:17:42 24 4
gpt4 key购买 nike

当我尝试使用以下 css 修复它的头部时,我有一个以下格式的表格,我失去了对齐,表格标题和主体没有正确对齐..我能做些什么来克服这个问题..

#ex_table
{

table-layout: fixed !important;
}

#ex_table thead tr
{
position: fixed !important;

}

这是 HTML 部分

<div class="table_div" style="height:400px;width:98%;overflow:scroll">
<table id="ex_table">
/*thead and tbody populated dynamically via jquery datatables*/
<tfoot id="ex_footer">
<tr>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</tfoot>
</table>
</div>

最佳答案

您必须严格设置单元格的宽度:

th, td { width:30px }

关于html - 使用 CSS 卡住表头时表头和正文未正确对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13265606/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com