{{HTMLRef}}
The HTML <p>
element (or HTML Paragraph Element) represents a paragraph of text. Paragraphs are usually represented in visual media as blocks of text that are separated from adjacent blocks by vertical blank space and/or first-line indentation. The paragraph must be closed at end of the text "<p> text </p>" are requried to put the text between the paragraph. 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.
The align
attribute on <p>
is obsolete. Do not use it.
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>
This produces:
{{EmbedLiveSample('Example')}}
Notes
To change gaps between paragraphs, use the 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')}} | No change since the latest W3C snapshot {{SpecName("HTML5 W3C")}} |
{{SpecName('HTML5 W3C', 'grouping-content.html#the-p-element', '<p>')}} | {{Spec2('HTML5 W3C')}} | align attribute is obsolete |
{{SpecName('HTML4.01', 'struct/text.html#h-9.3.1', '<p>')}} | {{Spec2('HTML4.01')}} | Initial definition |
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")}}