I have a table and i want to set a fixed width of 30px on the td's. the problem is that when the text in the td is too long, the td is stretched out wider than 30px. Overflow:hidden doesnt work either on the td's, I need some way of hiding the overflowing text and keeping the td width 30px.
<table cellpadding="0" cellspacing="0">
<tr>
<td>first</td><td>second</td><td>third</td><td>forth</td>
</tr>
<tr>
<td>first</td><td>this is really long</td><td>third</td><td>forth</td>
</tr>
</table>
you also can try to use that:
http://www.w3schools.com/cssref/pr_tab_table-layout.asp
Put a
div
insidetd
and give following stylewidth:50px;overflow: hidden;
to the divJsfiddle link
This workaround worked for me...
It's not the prettiest CSS, but I got this to work:
Examples, with and without ellipses:
Chrome 37. for non fixed
table
:first two important! else - its flow away!
Just divide the number of td to 100%. Example, you have 4 td's:
We use 25% in each td to maximize the 100% space of the entire table