将一行文本保留为一行 – 将整行或全部都打包
我想保留一行文本,以便整条线条落下或根本没有
可接受
How do I wrap this line of text - asked by Peter 2 days ago
可接受
How do I wrap this line of text - asked by Peter 2 days ago
不能接受的
How do I wrap this line of text - asked by Peter 2 days ago
这可以在CSS中实现吗?
你可以使用white-space: nowrap;
定义这个行为:
// HTML:
.nowrap { white-space: nowrap ; }
<p> <span class="nowrap">How do I wrap this line of text</span> <span class="nowrap">- asked by Peter 2 days ago</span> </p>
你也可以把非破坏的空间(&amp;他们)代替空格,这样他们就被迫留在一起。
How do I wrap this line of text - asked by Peter 2 days ago