<p> elementThe <p> element represents a paragraph. It groups text and related phrasing content into a structural unit, commonly used for explanations, descriptions, and other prose.
A paragraph can contain phrasing content, including plain text, links, emphasised words, and images. It cannot contain another <p>, a <div>, a list such as <ul>, or a <table>. A paragraph introducing a list must end before the list begins. These rules depend on the HTML elements, regardless of whether CSS makes them appear inline or as blocks.
When parsing HTML, the browser automatically closes an open paragraph when it encounters certain start tags, including <div>, <ul>, and another <p>. Attempting to nest these elements inside a paragraph therefore produces a document structure different from the apparent nesting in the source. Writing an explicit </p> before the next structural element makes the intended arrangement clear.
The closing tag can be omitted in certain defined circumstances, such as immediately before another paragraph, but writing both tags is a useful authoring convention. The example below uses two separate paragraphs, each with its own opening and closing tag.
Browsers normally display paragraphs as blocks with space between them. CSS controls that spacing and presentation. A <br> introduces a line break within a paragraph; a new paragraph starts a separate structural unit.
Attributes: GLOBALS.
Typical layout: <p> This paragraph explains one connected idea. </p> <p> This second paragraph starts a new thought. </p>
Visual representation:
This paragraph explains one connected idea.
This second paragraph starts a new thought.