我想将一行文本保持在一起,以便整行都向下一行或根本不行
可接受的
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
Not Acceptable
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>
// CSS:
.nowrap {
white-space: nowrap ;
}
关于html - 将一行文本保持为一行-将整行换行或根本不换行,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6667081/