今天碰到了td文字內容不換行,發現是:white-space: nowrap,即強制文本不進行換行,順便看了一下文本換行的屬性word-wrap,總結如下:
white-space的默認只是normal,自動換行。
word-break:break-all和word-wrap:break-word表示強制換行,前者若英文字符過長自動截斷,后者整個英文單詞會換行!
而而我常會這樣用:
word-wrap:break-word; overflow:hidden;
IE 下沒有任何問題,在 FF 下,長串英文會被遮住超出的內容
table中td.th強制換行方法:
<table style=”table-layout:fixed” width=”200″>
<tr>
<td width=”25%” style=”word-break : break-all; overflow:hidden; “>站長網www.software8.co原創教程</td>
<td width=”75%” style=”word-wrap : break-word; overflow:hidden; “>站長網www.software8.co原創教程</td>
</tr>
</table>
新聞熱點
疑難解答