Table of contents
- 1. Summary
- 1.1. Usage context
- 2. Attributes
- 3. DOM interface
- 4. Example
- 5. Notes
- 6. See also
Summary
Paragraph element (<p>) represents a paragraph. It is the most commonly used block-level element.
Usage context
| Permitted content | Phrasing content. |
| Tag omission | None, both the start tag and the end tag are mandatory. |
| Permitted parent elements | Any element that accepts flow content. |
| Normative document | HTML 5, section 4.5.1; HTML 4.01, section 9.3.1 |
Attributes
Like all other HTML elements, this element has the global attributes.
In HTML5
, the align attribute on <p> is
Obsolete
.
DOM interface
This element implements the HTMLParagraphElement interface.
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 margin property. Do not insert empty paragraphs elements or line breaks (<br>) between them.
Mozilla Developer Network