< p>之间不可能有2个空行?标签?降价 [英] Is it impossible to have 2 blank lines between <p> tag? Markdown

查看:375
本文介绍了< p>之间不可能有2个空行?标签?降价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自HTML1出现以来,HTML一直困扰着我。



一件事是关于换行符。



http://jsfiddle.net/LhDFs/2/

 < p> 1< / p> 
< p> 2< / p>

< p> br1< / p>
< br />
< p> br2< / p>

< p> p1< / p>
foo
< p> p2< / p>

< p> pp1< / p>
< p> foo< / p>
< p> pp2< / p>

p标签在元素之间有1条线。



< p> 之间不可能有2个空行?
看起来< br /> 或空格符号不起作用。



那么,当然,可以使用< br /> 来代替< p> ,但现在我调整了Markdown,尤其是gfm,所以我需要保留段落结构。



我简短的说,我们永远不会有2个空行,只要我们坚持< p>



我认为是

  foo 


bar

2空白行:而不是

  foo 



bar

3个带p标记结构的空白行。



编辑:

那么,我的目标是要有一致的P标签结构,我有一个暗示,我可以用CSS hack准备多个分类的p标记。



这首先想到了,但我认为我可以马上nage it。赞赏所有评论。

EDIT2:



我认为我们有解决方案这个,但似乎没有;
我发表另一篇文章:

在p标签之间似乎不可能有2个空行不需要修改原始元素

解决方案

标记中的空格(新行,空格)不会显示在网站的前端。

这样:

 < p>示例< / p> 
< p>示例< / p>

相同:

 < p为H. 
示例
< / p>


< p>
示例
< / p>

在网站上,这两个示例都会显示完全相同。



为了控制网站前端的空格,填充,空白和位置,我们使用css: HTML

 < p> 
示例
< / p>

CSS
< pre class =lang-css prettyprint-override> p {
padding-left:20px;
}

以下演示显示了由css控制的不同段落边距:



HTML

 < p class =noMargin >无边距< / p> 
< p class =noMargin>无保证金< / p>
< p class =noMargin>无保证金< / p>
< p>默认保证金< / p>
< p>默认保证金< / p>
< p>默认保证金< / p>
< p class =doubleMargin>双倍余量< / p>
< p class =doubleMargin>双倍余量< / p>
< p class =doubleMargin>双倍余量< / p>

CSS
< pre class =lang-css prettyprint-override> p.noMargin {
margin:0;
}
p.doubleMargin {
margin:2em 0;
}

演示


HTML have bothered me since HTML1 emerged.

One thing is about line breaks.

http://jsfiddle.net/LhDFs/2/

<p>1</p>
<p>2</p>

<p>br1</p>
<br/>
<p>br2</p>

<p>p1</p>
foo
<p>p2</p>

<p>pp1</p>
    <p>foo</p>
<p>pp2</p>

p tag has 1 line between the element.

Is it impossible to have 2 blank lines between <p>? It appears <br/> or space symbol doesn't work for that.

Well, of course, it's possible to use <br/> instead of <p>, but now I tweak Markdown, especially gfm, so I need to preserve paragraph structure.

I short, it's way too strange that we never be able to have 2 blank lines as long as we stick on <p>.

What I consider is

foo


bar

2 blank lines:instead of

foo



bar

3 blank lines with p tag structure.

EDIT:

Well, what I intended is to have consistent structure of P tag, but thanks to everyone, I've got a hint that I can prepare multiple classed p tag with CSS hack.

This is truly hacky on first thought, but I think I can manage it. Appreciated to all comments.

EDIT2:

I thought we have solution for this, but it seems not; I post another:

It seems impossible to have 2 blank lines between p tags Without modification of the original elements

解决方案

White space in your mark up (new lines, spaces) will not show up on the front end of a website.

This:

<p>example</p>
<p>example</p>

Is the same as:

<p>
    example
</p>


<p>
    example
</p>

On a website, both those examples will appear exactly the same.

To control spacing, padding, margin and position on the front end of a website we use css:

HTML

<p>
    example
</p>

CSS

p {
    padding-left: 20px;
}

Here is a demo showing different paragraph margins controlled by css:

HTML

<p class="noMargin">No margin</p>
<p class="noMargin">No margin</p>
<p class="noMargin">No margin</p>
<p>Default margin</p>
<p>Default margin</p>
<p>Default margin</p>
<p class="doubleMargin">Double margin</p>
<p class="doubleMargin">Double margin</p>
<p class="doubleMargin">Double margin</p>

CSS

p.noMargin {
    margin: 0;
}
p.doubleMargin {
    margin: 2em 0;
}

Demo

这篇关于&lt; p&gt;之间不可能有2个空行?标签?降价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆