HTML <p> Tag

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

Definition and Usage

The <p> element represents a paragraph — a block of related phrasing content, usually text. Browsers display paragraphs as separate blocks with default spacing between them.

Put readable body copy in <p>. Use <br> only for deliberate line breaks inside a paragraph, and <div> when you need a generic layout box without paragraph meaning.

Baseline · Widely available.

Core <p> support has been stable across browsers since about July 2015 (and much earlier in practice).

Deprecated · Obsolete attribute.

Do not use align on <p>. Align text with CSS text-align instead.

HTML Syntax

syntax.html
<p> text…</p>

The start tag is required. The end tag may be omitted in some cases, but beginners should always write both. Content must be phrasing content only (no nested <p>, <div>, or other blocks).

Attributes

Modern <p> has no special attributes beyond globals. One legacy attribute remains for reference:

AttributeDescriptionTry it
alignDeprecated · Obsolete. Old text alignment — use CSS text-alignTry it

Global Attributes

The <p> tag also supports the Global Attributes in HTML.

Live Preview

Switch between one paragraph and two. Spacing comes from real <p> defaults.

Real <p> elements. Prefer separate paragraphs over empty spacers.

Text

One paragraph block.

HTML Examples

Short, copy-ready snippets. Use Try It Yourself for a live editor.

Example 1 — Basic Paragraph

One idea, one <p>.

HTML
<p>
  Geckos are usually small, nocturnal lizards found on every continent except Antarctica.
</p>
Try It Yourself

How It Works

  1. Open <p> where the paragraph should start.
  2. Write the sentence(s) that belong together.
  3. Close with </p>.
  4. Let the browser add spacing — no empty paragraphs needed.

Example 2 — Multiple Paragraphs

Start a new <p> for each new idea.

HTML
<p>
  Geckos are a group of usually small, usually nocturnal lizards.
</p>
<p>
  Some species live in houses where they hunt insects attracted by artificial light.
</p>
Try It Yourself

How It Works

  1. Write the first paragraph in its own <p>.
  2. Close it before the next idea.
  3. Open a second <p> for the next block of text.
  4. Screen readers can jump paragraph by paragraph more easily.

Example 3 — Inline Markup Inside <p>

Links and emphasis are phrasing content — they belong inside the paragraph.

HTML
<p>
  Read the
  <a href="/html/tags">HTML tags</a>
  guide, and note the <strong>important</strong> rules for beginners.
</p>
Try It Yourself

How It Works

  1. Keep the outer wrapper as <p>.
  2. Add inline tags such as <a> or <strong> inside it.
  3. Do not nest block elements like <div> or another <p>.
  4. Use <br> sparingly for a forced line break, not for spacing paragraphs.

Example 4 — CSS Instead of align

Align paragraphs with CSS. Never revive obsolete align.

HTML
<p class="note">
  This paragraph is centered with CSS, not the obsolete align attribute.
</p>

<style>
  .note {
    text-align: center;
  }
</style>
Try It Yourself

How It Works

  1. Write a normal <p> with your text.
  2. Add a class when you need a special alignment.
  3. Set text-align in CSS (left, center, right, justify).
  4. Skip align="…" — it is obsolete on paragraphs.

Edge Cases & Pitfalls

Most paragraph bugs are empty spacers, nested blocks, or obsolete align.

a11y

No empty <p></p>

Screen readers may announce an empty paragraph. Create space with CSS margin instead.

structure

Blocks close paragraphs

If a browser sees a block (like <div> or <ul>) before </p>, it closes the paragraph early.

obsolete

Skip align

Use CSS text-align. The HTML align attribute on <p> is obsolete.

br

<br> is not a paragraph

Line breaks inside text are fine; stacking <br> to fake paragraphs is not.

seo

Real text in real paragraphs

Meaningful <p> blocks help readers and crawlers understand page content better than unlabeled div soup.

Browser Support

The <p> element is core HTML in every browser. It is not a Node.js, Deno, or Bun API.

✓ Baseline · Widely available

<p>

Widely available since about July 2015 (and long before). Chrome, Firefox, Safari, Edge, and Opera fully support the paragraph element.

98% Global support (approx.)
Google Chrome All
Full support
Mozilla Firefox All
Full support
Apple Safari All
Full support
Microsoft Edge All
Full support
Opera All
Full support
Samsung Internet All
Full support
Internet Explorer All
Supported
<p> Widely supported

Bottom line: Safe everywhere. Write real paragraphs, space them with CSS, and avoid obsolete align.

Key Takeaways

  • Role: <p> marks a paragraph of related phrasing content.
  • Structure: one idea per paragraph; phrasing content only inside.
  • Spacing: use CSS margin — never empty <p> tags.
  • Align: CSS text-align, not obsolete align.

One line: wrap each paragraph in <p>, keep only inline content inside, and style spacing with CSS.

Default CSS Settings

Typical user-agent stylesheet for paragraphs:

default.css
p {
  display: block;
  margin-block: 1em;
  margin-inline: 0;
}

Override margin when you need tighter or looser spacing. Prefer that over empty paragraph tags.

Frequently Asked Questions

The p element represents a paragraph — a block of related phrasing content, usually text. Browsers show paragraphs as separate blocks with default margin between them.
No useful modern attributes beyond the global attributes. The old align attribute is obsolete — use CSS text-align instead.
No. p may contain only phrasing content (text, spans, links, emphasis, and similar). A block like div or another p will close the paragraph early.
No. Empty paragraphs confuse screen readers. Add space with CSS margin (or gap in a flex/grid layout).
The start tag is required. The end tag may be omitted in some cases when another block follows, but beginners should always write both tags.
br only forces a line break inside text. div is a generic container with no paragraph meaning. Use p when the content is a paragraph.

Next: param

Learn the obsolete parameter element once used with object embeds.

param tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

20 people found this page helpful