如何在不使用< br/>的情况下从CSS换行? [英] How to line-break from css, without using <br />?
本文介绍了如何在不使用< br/>的情况下从CSS换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
输出:
hello
How are you
代码:
<p>hello <br> How are you </p>
如何在没有<br>
的情况下实现相同的输出?
How to achieve same output without <br>
?
推荐答案
使用相同的HTML结构是不可能的,您必须有一些东西来区分Hello
和How are you
.
Impossible with the same HTML structure, you must have something to distinguish between Hello
and How are you
.
我建议使用span
s,然后将其显示为块(实际上就像<div>
一样.)
I suggest using span
s that you will then display as blocks (just like a <div>
actually).
p span {
display: block;
}
<p><span>hello</span><span>How are you</span></p>
这篇关于如何在不使用< br/>的情况下从CSS换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文