关于table中使用了colspan后导致列宽度失效问题

因为一般表格都会定义一个table-layout: fixed;防止td被连串字符撑开,但是如果首行有合并单元格的话 TD宽度定义就会失效。
最好的办法,在最上边加以下代码来控制td宽度
<colgroup>
<col width=60%></col>
<col width=20%></col>
<col width=20%></col>
</colgroup>
单位也可以用PX,把这段代码放在tbody之前。
如:

<table class="tbBottomBorder" style="margin:0;padding:0;table-layout:fixed;">
<colgroup>
<col width=100px></col>
<col width=auto></col>
<col width=100px></col>
<col width=auto></col>
</colgroup>
<tr>
<th width="100px">备注:</th>
<td colspan="3">${obj.remark}</td>
</tr>
<tr>
<th width="100px">创建人:</th>
<td>${obj.crtEmpName}</td>
<th width="100px">创建时间:</th>
<td>${obj.crtTime}</td>
</tr>
<tr>
<th width="100px">修改人:</th>
<td>${obj.uptEmpName}</td>
<th width="100px">修改时间:</th>
<td>${obj.uptTime}</td>
</tr>
</table>

原文地址:https://www.cnblogs.com/zmc/p/15152881.html