如何在不使用 <br/> 的情况下从 css 换行? [英] How to line-break from css, without using <br />?
本文介绍了如何在不使用 <br/> 的情况下从 css 换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
输出:
代码:
code:
如何在没有
的情况下实现相同的输出?
<p>hello <br> How are you </p>
推荐答案
不可能有相同的 HTML 结构,你必须有什么区别 Hello
和 How are you
.
解决方案
我建议使用 span
,然后您将其显示为块(实际上就像
Impossible with the same HTML structure, you must have something to distinguish between Hello
and How are you
.
一样).
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屋!
查看全文