以前只知道word-wrap: break-word; word-break:
break-all;,如果全部都是“!”之类的字符,仍然没效果。今天google,发现了另外一个CSS属性table-layout:
fixed,它们需要配合使用:
<table width="200" border="1" style="table-layout: fixed">
<tr>
<td style="word-wrap: break-word; word-break: break-all;">!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!</td>
</tr>
</table>
<table width="200" border="1" style="table-layout: fixed">
<tr>
<td style="word-wrap: break-word; word-break: break-all;">!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!</td>
</tr>
</table>