.net

.net

博客园 首页 新随笔 联系 订阅 管理

因为一般表格都会定义一个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>

posted on 2021-08-17 16:27  航宇  阅读(694)  评论(0编辑  收藏  举报