Static lengthStatic length
...">

TD Width - Minimal CSS Required

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 get the third column to take the minimum width (depending on its contents) and the fourth column to take the rest?

+5
source share
1 answer

Use this

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

Demo

+8
source

All Articles