如何实现相同的输出没有<br>?
<p>hello <br> How are you </p>
输出:
hello How are you
如何实现相同的输出没有<br>?
<p>hello <br> How are you </p>
输出:
hello How are you
当前回答
使用,而不是空格将防止中断。
<span>I DONT WANT TO BREAK THIS LINE UP, but this text can be on any line.</span>
其他回答
使用,而不是空格将防止中断。
<span>I DONT WANT TO BREAK THIS LINE UP, but this text can be on any line.</span>
<pre> <---------------------------------------
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
</pre> <--------------------------------------
OR
<div style="white-space:pre"> <-----------------------------------
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
lorem ipsum
</div> <-----------------------------------
来源:https://stackoverflow.com/a/36191199/2377343
代码可以是:
<div class="text-class"><span>hello</span><span>How are you</span></div>
CSS将是:
.text-class {
display: flex;
justify-content: flex-start;
flex-direction: column;
align-items: center;
}
CSS中的“\a”命令生成一个回车。这是CSS,不是HTML,所以它应该更接近你想要的:没有额外的标记。
在一个blockquote中,下面的例子同时显示标题和源链接,并用回车符("\a")分隔两者:
blockquote[title][cite]:after {
content:attr(title)"\a"attr(cite)
}
这适用于Chrome浏览器:
p::after {
content: "-";
color: transparent;
display: block;
}