【问题标题】:TD width - the minimum needed using CSSTD 宽度 - 使用 CSS 所需的最小值
【发布时间】:2013-04-19 05:51:02
【问题描述】:

考虑这张表:

<table style="width: 100%">
    <tr>
        <td>Static length</td>
        <td>Static length</td>
        <td><div>Length varies</div></td>
        <td>Space filler</td>
    </tr>
    <tr>
        ...
    </tr>
</table>

如何使第 3 列采用最小宽度(取决于其内容),第 4 列采用其余部分?

【问题讨论】:

    标签: html css html-table width


    【解决方案1】:

    使用这个

    td:nth-child(3){
        background:red;
        width: 1px;
        white-space: nowrap;
    }
    

    DEMO

    【讨论】:

    • 有效!感谢演示
    猜你喜欢
    • 1970-01-01
    • 2012-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-30
    • 1970-01-01
    • 1970-01-01
    • 2013-08-05
    相关资源
    最近更新 更多