zoukankan      html  css  js  c++  java
  • 关于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>

  • 相关阅读:
    oo第八次作业--5,6,7次作业总结
    OO前三次作业总结
    软工总结
    黄衫感想博客
    软工结对编程博客
    软工第一次阅读
    软工第0次作业
    OO第四次博客
    OO第三次博客
    OO第二次博客
  • 原文地址:https://www.cnblogs.com/zmc/p/15152881.html
Copyright © 2011-2022 走看看