http://jsfiddle.net/L2yLe/
The fiddle says it all. I want a css-only solution that limits the width of the table to the width of the div. The long string should be broken (but as you can see it isn't), and that causes the table to overflow.
I don't want to use any pixel widths. This should be completely fluid.
<div>
<table>
<tr>
<td>
short string
</td>
<td>
somereallylongstringofdatasomereallylongstringofdatasomereallylongstringofdata
</td>
<td>
short string
</td>
</tr>
</table>
</div>
div {
width: 50%;
background-color: darkgray;
padding: 15px;
margin: 10px auto;
}
table {
border-collapse: collapse;
}
td {
border: 1px solid black;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…