p
{
white-space: nowrap
}



Here are"/>

css如何设置英文单词不换行?

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;不换行,超出部分隐藏且以省略号形式出现

以上就是css如何设置英文单词不换行?的详细内容,更多请关注易知道|edz.cc其它相关文章!

推荐阅读