Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 659495 of <p>

  • Revision slug: Web/HTML/Element/p
  • Revision title: <p>
  • Revision id: 659495
  • Created:
  • Creator: shamimahsan600
  • Is current revision? No
  • Comment

Revision Content

Summary

The HTML <p> element (or HTML Paragraph Element) represents a paragraph of text. Paragraphs are block-level elements.

  • Content categories Flow content, palpable content.
  • Permitted content Phrasing content.
  • Tag omission The start tag is mandatory. The end tag may be omitted if the {{HTMLElement("p")}} element is immediately followed by an {{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")}} or another {{HTMLElement("p")}} element, or if there is no more content in the parent element and the parent element is not an {{HTMLElement("a")}} element.
  • Permitted parent elements Any element that accepts flow content.
  • DOM interface {{domxref("HTMLParagraphElement")}}

Attributes

This element includes the global attributes.

In {{HTMLVersionInline(5)}}, the align attribute on <p> is {{obsolete_inline}}.

Example

<p>This is the first paragraph of text. This is the first paragraph of text.
  This is the first paragraph of text. This is the first paragraph of text.</p>

<p>This is second paragraph of text. This is second paragraph of text.
   This is second paragraph of text. This is second paragraph of text.</p>

Above HTML will output:

This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.

This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.

Notes

To change gaps between paragraphs use CSS {{cssxref("margin")}} property. Do not insert empty paragraphs elements or {{HTMLElement("br")}} between them.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', 'grouping-content.html#the-p-element', '<p>')}} {{Spec2('HTML WHATWG')}}  
{{SpecName('HTML5 W3C', 'grouping-content.html#the-p-element', '<p>')}} {{Spec2('HTML5 W3C')}}  
{{SpecName('HTML4.01', 'struct/text.html#h-9.3.1', '<p>')}} {{Spec2('HTML4.01')}}  

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 {{CompatGeckoDesktop("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{CompatVersionUnknown}} {{CompatGeckoMobile("1.0")}} {{CompatVersionUnknown}} {{CompatVersionUnknown}} {{CompatVersionUnknown}}

See also

  • {{HTMLElement("hr")}}
  • {{HTMLElement("br")}}
{{HTMLRef}}

Revision Source

<h2 id="Summary">Summary</h2>
<p><span class="seoSummary">The <strong>HTML <code>&lt;p&gt;</code> element</strong> <em>(</em>or <em>HTML Paragraph Element)</em> represents a paragraph of text.</span> Paragraphs are <a href="/en-US/docs/HTML/Block-level_elements">block-level elements</a>.</p>
<ul class="htmlelt">
 <li><dfn><a href="/en-US/docs/Web/HTML/Content_categories">Content categories</a></dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">Flow content</a>, palpable content.</li>
 <li><dfn>Permitted content</dfn> <a href="/en-US/docs/Web/HTML/Content_categories#Phrasing_content">Phrasing content</a>.</li>
 <li><dfn>Tag omission</dfn> The start tag is mandatory. The end tag may be omitted if the {{HTMLElement("p")}} element is immediately followed by an {{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")}} or another {{HTMLElement("p")}} element, or if there is no more content in the parent element and the parent element is not an {{HTMLElement("a")}} element.</li>
 <li><dfn>Permitted parent elements</dfn> Any element that accepts <a href="/en-US/docs/Web/HTML/Content_categories#Flow_content">flow content</a>.</li>
 <li><dfn>DOM interface</dfn> {{domxref("HTMLParagraphElement")}}</li>
</ul>
<h2 id="Attributes">Attributes</h2>
<p>This element includes the <a href="/en-US/docs/Web/HTML/Global_attributes">global attributes</a>.</p>
<p>In {{HTMLVersionInline(5)}}, the <strong>align</strong> attribute on <code>&lt;p&gt;</code> is {{obsolete_inline}}.</p>
<h2 id="Example">Example</h2>
<pre class="brush: html">
&lt;p&gt;This is the first paragraph of text. This is the first paragraph of text.
  This is the first paragraph of text. This is the first paragraph of text.&lt;/p&gt;

&lt;p&gt;This is second paragraph of text. This is second paragraph of text.
   This is second paragraph of text. This is second paragraph of text.&lt;/p&gt;
</pre>
<p>Above HTML will output:</p>
<p>This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.</p>
<p>This is second paragraph of text. This is second paragraph of text. This is second paragraph of text. This is second paragraph of text.</p>
<h2 id="Notes">Notes</h2>
<p>To change gaps between paragraphs use <a href="/en-US/docs/Web/CSS">CSS</a> {{cssxref("margin")}} property. <strong>Do not</strong> insert empty paragraphs elements or {{HTMLElement("br")}} between them.</p>
<h2 id="Specifications" name="Specifications">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', '&lt;p&gt;')}}</td>
   <td>{{Spec2('HTML WHATWG')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML5 W3C', 'grouping-content.html#the-p-element', '&lt;p&gt;')}}</td>
   <td>{{Spec2('HTML5 W3C')}}</td>
   <td>&nbsp;</td>
  </tr>
  <tr>
   <td>{{SpecName('HTML4.01', 'struct/text.html#h-9.3.1', '&lt;p&gt;')}}</td>
   <td>{{Spec2('HTML4.01')}}</td>
   <td>&nbsp;</td>
  </tr>
 </tbody>
</table>
<h2 id="Browser_compatibility" name="Browser_compatibility">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="See_also">See also</h2>
<ul>
 <li>{{HTMLElement("hr")}}</li>
 <li>{{HTMLElement("br")}}</li>
</ul>
<div>
 {{HTMLRef}}</div>
Revert to this revision