word-wrap在IE中不工作 [英] word-wrap does not work in IE
问题描述
文字换行如下:
/* The Breakage of Too Long Words */
div.break_word {
width: 690px;
word-wrap: break-word;
}
会包装下面的表格, :
does wrap the word for the following table, but it also keeps the table stretched:
我在表格的这个部分使用它:
I used it in this portion of the table:
<!-- The Contribution Description -->
<tr>
<td colspan="3"><div class="break_word"><p><?php echo $contribution_description; ?></p></div></td>
</tr>
<!-- The Separation Line -->
<tr>
<td colspan="3"></td>
</tr>
<!-- The Contribution -->
<tr>
<td colspan="3"><pre><div class="break_word"><?php echo $contribution; ?></div></pre></td>
</tr>
</table>
它是否保持伸展,因为它是一个整体而不是一个div?
Does it keep it stretched, because it is overall a table and not a div? Or for which reason does it not stretch back, because the word is indeed wrapped.
推荐答案
由于word-wrap是一个CSS3属性,它只支持IE9和更高版本。对于IE8尝试
As word-wrap is a CSS3 property, it is only supported by IE9 and higher. For IE8 try
-ms-word-wrap
因此请尝试
div.break_word {
width: 690px;
word-wrap: break-word;
-ms-word-wrap: break-word;
}
希望这有帮助。
更新
似乎即使在IE7中使用-ms-word-wrap,它默认为white- space:nowrap ;然后覆盖word-wrap属性。
It seems that even if you use -ms-word-wrap in IE7, it defaults the white-space: nowrap; which then overrides the word-wrap property.
再次需要IE黑客。尝试为IE7添加此项。
Once again a IE hack is required. Try adding this for IE7.
white-space: normal;
这篇关于word-wrap在IE中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!