表td中的max-width

时间:2014-05-06 10:04:11

标签: html css css3 html-table

我想设置我的表td的最大宽度。

<td class="showwindow description">
    <div style="width:275px; white-space:nowrap; word-wrap:break-word; font-size:11px;">3 DRESS COVER AY (AGAVE PINK) 3 DRESS COVER AY (AGAVE PINK) 3 DRESS COVER AY (AGAVE PINK)</div>
</td>

但是文字无法回到原帖:

enter image description here

3 个答案:

答案 0 :(得分:0)

只需使用此CSS代码:

max-width:100px;

http://www.w3schools.com/cssref/pr_dim_max-width.asp

答案 1 :(得分:0)

你可能已经给出了宽度,但你必须为td和div都给予高度,这样如果文本超出,它应该回退到下一行,只给出宽度不会做太多

答案 2 :(得分:0)

只需从div中删除“white-space:nowrap”属性并设置max-width。

相关问题