diff options
Diffstat (limited to 'files/zh-cn/web/html/element/p/index.html')
| -rw-r--r-- | files/zh-cn/web/html/element/p/index.html | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/element/p/index.html b/files/zh-cn/web/html/element/p/index.html new file mode 100644 index 0000000000..7cddbfea58 --- /dev/null +++ b/files/zh-cn/web/html/element/p/index.html @@ -0,0 +1,129 @@ +--- +title: <p> +slug: Web/HTML/Element/p +tags: + - Element + - HTML + - HTML grouping content + - Web + - 参考 +translation_of: Web/HTML/Element/p +--- +<div>{{HTMLRef}}</div> + +<p><strong>HTML <p></strong>元素(或者说 HTML 段落元素)表示文本的一个段落。该元素通常表现为一整块与相邻文本分离的文本,或以垂直的空白隔离或以首行缩进。另外,<p> 是<a href="/en-US/docs/HTML/Block-level_elements">块级元素</a>。</p> + +<ul class="htmlelt"> + <li><dfn><a href="/en-US/docs/Web/HTML/Content_categories">内容分类</a></dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, palpable content.</li> + <li><dfn>允许的内容</dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">Phrasing content</a>.</li> + <li><dfn>标签省略</dfn>起始标签是必需的,结束标签在以下情形中可以省略。<p>元素后紧跟{{HTMLElement("address")}}, {{HTMLElement("article")}}, {{HTMLElement("aside")}}, {{HTMLElement("blockquote")}}, {{HTMLElement("div")}}, {{HTMLElement("dl")}}, {{HTMLElement("fieldset")}}, {{HTMLElement("footer")}}, {{HTMLElement("form")}}, {{HTMLElement("h1")}}, {{HTMLElement("h2")}}, {{HTMLElement("h3")}}, {{HTMLElement("h4")}}, {{HTMLElement("h5")}}, {{HTMLElement("h6")}}, {{HTMLElement("header")}}, {{HTMLElement("hr")}}, {{HTMLElement("menu")}}, {{HTMLElement("nav")}}, {{HTMLElement("ol")}}, {{HTMLElement("pre")}}, {{HTMLElement("section")}}, {{HTMLElement("table")}}, {{HTMLElement("ul")}}或另一个{{HTMLElement("p")}}元素;或者父元素中没有其他内容了,而且父元素不是{{HTMLElement("a")}}元素</li> + <li><dfn>允许的父元素</dfn>任何接受<a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">flow content</a>的元素</li> + <li><dfn>DOM接口</dfn> {{domxref("HTMLParagraphElement")}}</li> +</ul> + +<h2 id="属性">属性</h2> + +<p>这个元素包含<a href="/en-US/docs/Web/HTML/Global_attributes">全局属性</a>。</p> + +<p><span style="line-height: 1.5;"><p> 元素的 </span><strong style="line-height: 1.5;">align </strong><span style="line-height: 1.5;">属性已被弃用,请不要使用</span><span style="line-height: 1.5;">。</span></p> + +<h2 id="示例">示例</h2> + +<pre class="brush: html"><p>这是第一个段落。这是第一个段落。 + 这是第一个段落。这是第一个段落。</p> +<p>这是第二个段落。<span style="font-size: 1rem;">这是第二个段落。 +</span><span style="font-size: 1rem;"> 这是第二个段落。</span><span style="font-size: 1rem;">这是第二个段落。</span><span style="font-size: 1rem;"></p></span></pre> + +<p>输出如下:</p> + +<p>{{ EmbedLiveSample('示例', '', '', '', 'Web/HTML/Element/p') }}</p> + +<h2 id="注意">注意</h2> + +<p>使用<a href="/en-US/docs/Web/CSS" style="line-height: 1.5;">CSS</a><span style="line-height: 1.5;"> {{cssxref("margin")}}属性</span><span style="line-height: 1.5;">去改变段落之间的间隙,<strong>不要</strong>在段落之间插入空的段落元素或者</span><span style="line-height: 1.5;">{{HTMLElement("br")}}元素。</span></p> + +<h2 id="Specifications" name="Specifications">规范</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'grouping-content.html#the-p-element', '<p>')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', 'grouping-content.html#the-p-element', '<p>')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.3.1', '<p>')}}</td> + <td>{{Spec2('HTML4.01')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<div>{{CompatibilityTable}}</div> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0</td> + <td>{{CompatGeckoDesktop("1.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Firefox Mobile (Gecko)</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatGeckoMobile("1.0")}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + <td>{{CompatVersionUnknown}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="另请参阅">另请参阅</h2> + +<ul> + <li>{{HTMLElement("hr")}}</li> + <li>{{HTMLElement("br")}}</li> +</ul> |
