换行,word-wrap,white-space今天碰到了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>
换行,word-wrap,white-space
|