CSS 可以通过 Word-wrap 属性来设置英文单词不换行, 将 Word-wrap 属性的属性值设为 nowrap 即可设置英文单词强制不换行.
CSS 设置强制英文不换行:
- <html>
- <head>
- <style type="text/css">
- p { white-space: nowrap }
- </style>
- </head>
- <body>
- <p>
- Here are some texts. Here are some texts. Here are some texts. Here are
- some texts. Here are some texts. Here are some texts. Here are some texts.
- Here are some texts. Here are some texts. Here are some texts. Here are
- some texts. Here are some texts.
- </p>
- </body>
- </HTML>
效果图:
white-space 属性值及作用:
1. Word-break:break-all; 只对英文起作用, 以字母作为换行依据
2. Word-wrap:break-Word; 只对英文起作用, 以单词作为换行依据
3.{white-space:pre-wrap; 只对中文起作用, 强制换行
4.{white-space:nowrap; 强制不换行, 都起作用
5.{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; 不换行, 超出部分隐藏且以省略号形式出现
来源: http://www.css88.com/qa/css3/12359.html