HTML - <p>
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.
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:
Description
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 <p> element is immediately followed by an <address> , <article> , <aside> , <blockquote> , <div> , <dl> , <fieldset> , <footer> , <form> , <h1> , <h2> , <h3> , <h4> , <h5> , <h6> , <header> , <hr> , <menu> , <nav> , <ol> , <pre> , <section> , <table> , <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element. |
Permitted parent elements | Any element that accepts flow content. |
DOM interface | HTMLParagraphElement |
Browser Compatibility
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | 1.0 | 1.0 (1.7 or earlier) | (Yes) | (Yes) | (Yes) |
Feature | Android | Firefox Mobile (Gecko) | IE Phone | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | 1.0 (1.0) | (Yes) | (Yes) | (Yes) |
Notes
To change gaps between paragraphs, use the CSS margin
property. Do not insert empty paragraphs elements or <br>
between them.
See Also
Specifications
Specification | Status | Comment |
---|---|---|
WHATWG HTML Living Standard The definition of '<p>' in that specification. |
Living Standard | No change since the latest W3C snapshot HTML5 |
HTML5 The definition of '<p>' in that specification. |
Recommendation | align attribute is obsolete |
HTML 4.01 Specification The definition of '<p>' in that specification. |
Recommendation | Initial definition |
License
© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/html/element/p