Tables work differently; sometimes counter-intuitive.
The solution is to use width in the table cells instead of max-width .
Although it might seem that in this case the cells will not shrink below the specified width, they will actually be.
without c restrictions, if you give the table a width of 70 pixels, the width of a, b and c will come out as 16, 42 and 12 pixels respectively.
With a table width of 400 pixels, they behave the way you say you expect higher in your grid.
Only if you try to give the table too small a size (smaller than a.min + b.min + the contents of C), it will not work: then the table itself will be wider than indicated.
I made a fragment based on your fiddle in which I removed all borders, paddings and border-spacing so that you can measure the width more accurately.
table { width: 70px; } table, tbody, tr, td { margin: 0; padding: 0; border: 0; border-spacing: 0; } .a, .c { background-color: red; } .b { background-color: #F77; } .a { min-width: 10px; width: 20px; max-width: 20px; } .b { min-width: 40px; width: 45px; max-width: 45px; } .c {}
<table> <tr> <td class="a">A</td> <td class="b">B</td> <td class="c">C</td> </tr> </table>
Mr Lister Aug 22 '13 at 8:30 a.m. 2013-08-22 08:30
source share