Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make "Greedy" Table Cell?

I have a row in a table that has 3 cells in it with values A, B, and C and the table is the full width of the screen, which is more than enough room for all 3. Right now, when they display, all cells are getting 1/3 of the room, but this isn't what I want. I want the 2nd and 3rd cells to be their "correct" size, and the first cell to take up the difference. I can't just set the width on them because they are dynamically sized. How can I do this?

like image 380
skaz Avatar asked Aug 19 '11 19:08

skaz


1 Answers

Just set the width of the table to 100%, the width of A to 100% and B and C to auto. Tested and working

<table border="1px" width="100%">
    <tr>
        <td width="100%">A</td>
        <td width="auto">BB</td>
        <td width="auto">CCC</td>
    </tr>
</table>
like image 92
Deep Frozen Avatar answered Oct 03 '22 10:10

Deep Frozen