css - 如何强制 `span` 不在行尾换行?

标签 css word-wrap

如果是很长的文本行,我希望它不换行地延伸

最佳答案

尝试

span
{
  white-space: pre;
}

any other value that fits from the w3c spec :

normal
This value directs user agents to collapse sequences of white space, and break lines as necessary to fill line boxes.

pre
This value prevents user agents from collapsing sequences of white space. Lines are only broken at preserved newline characters.

nowrap
This value collapses white space as for 'normal', but suppresses line breaks within text.

pre-wrap
This value prevents user agents from collapsing sequences of white space. Lines are broken at preserved newline characters, and as necessary to fill line boxes.

pre-line
This value directs user agents to collapse sequences of white space. Lines are broken at preserved newline characters, and as necessary to fill line boxes.

You should also be aware that there is limited IE support for some of the listed options .

警告,跨浏览器内容困惑:您可以将行中的所有空格替换为  

关于css - 如何强制 `span` 不在行尾换行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7015317/

相关文章:

javascript - 尝试使用 Javascript 和 CSS 绘制网格元素

css - 位置 :absolute within a display:inline

html - 重叠 td 与不同的背景

javascript - HTML 多个页面中的多个列

html - 边框底部,环绕文字

c# - 如何从 C# 中的一行检测字符串溢出?

javascript - 两个具有不同 css 样式的打印按钮

c# - WPF RichTextBox 自动换行

html - 如何使段落中的最后一个 span 元素不换行?

php - 在 <div> 中每 2500 个字符换行文本以使用 PHP 或 javascript 进行分页