6

Consider this table:

<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>

How can I make the 3rd column to take the minimum width (depending on its content) and the 4th column to take the rest?

4

1 回答 1

9

用这个

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

演示

于 2013-04-25T11:04:15.547 回答