[英]Table cell borders not aligning when using colspan
我正在嘗試對齊兩個HTML表,一個在另一個下面。 原因是我需要兩個標題,並且在用戶滾動時它們都需要保持固定。 我正在使用jQuery floatThead來實現這一點,但它只浮動單個thead
行。 我的解決方法是這樣的:
<div>
<table style="width:100%;">
<thead>
<tr>
<th colspan="2" style="width:50%;">Etc</th>
<th colspan="2" style="width:50%;">Etc</th>
</tr>
</thead>
</table>
</div>
<div class="floatTheadContainer">
<table style="width:100%;">
<thead>
<tr>
<th style="width:25%;">Etc</th>
<th style="width:25%;">Etc</th>
<th style="width:25%;">Etc</th>
<th style="width:25%;">Etc</th>
</tr>
</thead>
</table>
</div>
更現實的示例是在JSFiddle上 -即使寬度百分比相等,單元格邊界也不對齊
您有<th style="width:2%;"></th>
,它添加了額外的框。 我假設這就是您想要的。 這是一個演示 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.