References

Beginner-friendly references for web development, with live, editable examples.

The HTML <p> tag

Element All modern browsers Updated
Quick answer

The HTML <p> element represents a paragraph of text. It is a block-level element that browsers render with spacing above and below, and it is the standard building block for body copy.

Overview

The <p> element marks up a paragraph — the most common way to group running text. Browsers add default margins above and below each paragraph, so consecutive <p> elements are visually separated.

A paragraph may only contain phrasing (inline) content such as text, <a>, <strong>, <span> and <img> — never block-level elements like a <div> or another <p>. The closing tag is optional in HTML, but always writing it keeps your markup clear and avoids surprises.

Syntax

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

Example

Live example
<p>HTML paragraphs are blocks of text.</p>
<p>Each paragraph is separated by default spacing from the browser.</p>

Best practices

  • Use <p> for real paragraphs of text, not as a generic spacer.
  • Control spacing with CSS margin, not empty paragraphs or stacked <br> tags.
  • Keep only inline content inside a paragraph.
  • Always include the closing </p> tag for clarity.

Frequently asked questions

What does the <p> element do?
It defines a paragraph. Browsers render each paragraph as a block with spacing above and below.
Can I put a <div> inside a <p>?
No. A paragraph may only contain inline (phrasing) content. Placing a <div> or another <p> inside it automatically closes the paragraph.
How do I add space between paragraphs?
Style the paragraph margins with CSS (for example p { margin-bottom: 1rem; }) rather than inserting empty paragraphs or <br> tags.
Is the closing </p> tag required?
It is technically optional, but always include it — it makes your markup unambiguous and easier to maintain.
How do I center text in a paragraph?
Use CSS: p { text-align: center; }. Avoid deprecated presentational attributes — alignment belongs in CSS.