双换行 HTML 标签
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17241890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Double line break HTML tag
提问by Dummy Code
I am creating a website and I find myself doing </br></br>
a lot in order to create a new paragraph looking like this...
我正在创建一个网站,我发现自己做</br></br>
了很多工作来创建一个看起来像这样的新段落......
Paragraph 1
Paragraph 2
I have already created a <tab>
tag to indent paragraphs but I am wondering if I could create a <break>
tag and in puts in two new lines to save me some time.
我已经创建了一个<tab>
标签来缩进段落,但我想知道我是否可以创建一个<break>
标签并输入两个新行以节省一些时间。
Can anyone point me in the right direction?
任何人都可以指出我正确的方向吗?
Thanks!
谢谢!
-Henry
-亨利
回答by G-Cyrillus
If <p>
are not needed semanticly(?), you may change <br/>
defaut values:
如果<p>
语义上不需要(?),您可以更改<br/>
默认值:
br {
margin:2.5em 0;/* FF for instance */
line-height:5em;/* chrome for instance */
}
http://codepen.io/anon/pen/cJwDhI<=here it's 5em, to make it obvious :)
http://codepen.io/anon/pen/cJwDhI<=这里是 5em,以使其显而易见:)
回答by rlemon
you can use the p
tag: http://www.w3.org/TR/html-markup/p.html
你可以使用p
标签:http: //www.w3.org/TR/html-markup/p.html
<p>Paragraph 1</p>
<p>Paragraph 2</p>
as a side note: you really should look into using semantic html
作为旁注:你真的应该考虑使用语义 html
回答by Hyperbola
Use a <pre>
tag. It saves the formatting within.
使用<pre>
标签。它保存其中的格式。
<pre>
My first line.
My second line after two line breaks.
</pre>