Guy*_*ere 17 css words html-table long-integer
这就是我所拥有的:
<td style='width:500px; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;'>
Ste*_*eve 35
我用了:
word-wrap: break-word;
word-break: break-all;
table-layout: fixed;
Run Code Online (Sandbox Code Playgroud)
table-layout: fixed 是让它发挥作用的关键.
Red*_*Red 14
我认为这个解决方案会对你有帮助!
pre {
white-space: pre; /* CSS 2.0 */
white-space: pre-wrap; /* CSS 2.1 */
white-space: pre-line; /* CSS 3.0 */
white-space: -pre-wrap; /* Opera 4-6 */
white-space: -o-pre-wrap; /* Opera 7 */
white-space: -moz-pre-wrap; /* Mozilla */
white-space: -hp-pre-wrap; /* HP Printers */
word-wrap: break-word; /* IE 5+ */
}
Run Code Online (Sandbox Code Playgroud)
http://perishablepress.com/press/2010/06/01/wrapping-content/
//编辑
这已经很长时间了,因为这被认为是最好的答案,需要更新.请参阅下面的@ benhowdle89和@ Steve的答案.
因此,当前的浏览器支持现在足以使用word-break,以便允许在多行上分割单词.
word-break: break-all
http://caniuse.com/#feat=word-break
| 归档时间: |
|
| 查看次数: |
23648 次 |
| 最近记录: |