HTML <p> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
HTML Text

What You’ll Learn

The <p> tag is the foundation of readable web text. This guide covers syntax, global attributes, common paragraph patterns, styling, and best practices for beginners.

01

Paragraphs

Structure body text.

02

Block Element

Starts on new line.

03

Global Attributes

class, id, style.

04

Multiple p Tags

Separate paragraphs.

05

CSS Styling

Emphasize content.

06

Readable Content

SEO-friendly structure.

What Is the <p> Tag?

The <p> tag is an essential HTML element used to define paragraphs of text. It provides a simple yet effective way to structure content, making it easy for both developers and browsers to understand and render text in a well-organized manner.

Valid HTML — Core Text Element

Every article, blog post, and landing page relies on <p> to break body copy into readable chunks with natural spacing.

Browsers treat <p> as a block-level element, so each paragraph starts on a new line and typically has top and bottom margin applied by default.

📝 Syntax

Enclose your text within opening <p> and closing </p> tags:

syntax.html
<p>Your paragraph text goes here.</p>

Syntax Rules

  • One paragraph per p element — do not use br alone to fake paragraphs.
  • Do not nest block elements (like div or another p) inside p.
  • Inline elements such as strong, em, and a are valid inside p.
  • Always close the tag; unclosed paragraphs can break page layout.

⚡ Quick Reference

TopicCode SnippetNotes
Basic paragraph<p>Text here.</p>Single block of text
Multiple paragraphsSeparate p tagsBrowser adds spacing
CSS classclass="intro"Global attribute
Inline stylestyle="font-size:16px"Use CSS files instead
Display typeBlock-levelFull width by default
Browser supportUniversalAll browsers

⚖️ <p> vs <div>

ElementPurposeWhen to use
<p>Paragraph of textBody copy, descriptions
<div>Generic containerLayout, grouping non-text
<br>Line break inside textPoetry, addresses — not paragraphs

🧰 Attributes

The <p> tag has no tag-specific attributes. It supports global HTML attributes such as class and style for styling:

attributes.html
<p class="highlight" style="font-size: 16px;">Your Styled Paragraph Here</p>
class CSS

Applies stylesheet rules to the paragraph.

class="intro"
id Target

Unique identifier for links, scripts, or CSS.

id="summary"
style Inline

Inline CSS declarations on the element.

style="color: red;"
lang Language

Declares the language of the paragraph text.

lang="en"

Examples Gallery

Write single paragraphs, stack multiple blocks, and style text with CSS classes.

👀 Live Preview

Two separate paragraphs with default block spacing:

First paragraph of sample text.

Second paragraph on its own line.

📚 Common Use Cases

The <p> tag structures textual content into readable paragraphs and supports styling through global attributes and CSS.

Single Paragraph

The primary purpose of p is to define a single paragraph of text within your HTML document.

single-paragraph.html
<p>This is a simple paragraph of text.</p>
Try It Yourself

Multiple Paragraphs

Use multiple p tags to structure different paragraphs, aiding in the organization of your content.

multiple-paragraphs.html
<p>First paragraph.</p>
<p>Second paragraph.</p>
Try It Yourself

Styling Text

Apply styles to your paragraphs using CSS to enhance the visual presentation of your content.

styling-text.html
<p class="important-text">This paragraph is styled for emphasis.</p>
Try It Yourself

♿ Accessibility

  • Keep paragraphs concise — Shorter blocks are easier to read for all users, including screen reader listeners.
  • Use semantic markup inside p — Prefer strong and em over bare styling for emphasis.
  • Set lang when needed — Use lang on paragraphs in a different language.
  • Don’t skip heading hierarchy — Use headings for sections; use p for body text beneath them.

🧠 How <p> Works

1

Author writes text

Wrap each text block in <p> opening and closing tags.

Markup
2

Browser renders block

Each p displays as a block with default top and bottom margin.

Layout
3

CSS styles apply

Classes and styles adjust font, color, and spacing.

Design
=

Readable web content

Structured paragraphs improve readability, accessibility, and SEO.

Browser Support

The <p> tag is supported in all major browsers, including every version of Internet Explorer.

Baseline · HTML / HTML5

Universal paragraph support

Every browser renders <p> as a block-level text container.

100% Core tag support
Google Chrome Fully supported
Full support
Mozilla Firefox Fully supported
Full support
Apple Safari Fully supported
Full support
Microsoft Edge Fully supported
Full support
Internet Explorer Fully supported · EOL
Full support
Opera Fully supported
Full support
<p> tag 100% supported

Bottom line: Use <p> confidently in any browser for paragraph text.

Conclusion

The <p> tag is a cornerstone of HTML, enabling developers to create well-structured and visually appealing textual content. Utilize it effectively to convey information in a clear and organized manner, enhancing the overall user experience on your website.

💡 Best Practices

✅ Do

  • Structure text logically with separate p tags
  • Combine with strong, em, and a inside paragraphs
  • Apply consistent CSS styling across paragraphs
  • Prefer external CSS over inline style

❌ Don’t

  • Nest block elements inside p
  • Use multiple br tags instead of new paragraphs
  • Wrap entire page layout in a single p
  • Use p for non-text containers

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <p>

Bookmark these before you write body copy.

6
Core concepts
🗃 02

Block-level

New line + margin.

Layout
⚙️ 03

Global attrs

class, id, style.

Attributes
📝 04

One per block

Separate p per paragraph.

Structure
🎨 05

CSS styling

Classes for emphasis.

Design
🌐 06

100% Support

All browsers ever.

Compatibility

❓ Frequently Asked Questions

It defines a paragraph of text on a web page.
No tag-specific attributes. Use global ones like class, id, and style.
Use a separate <p> element for each paragraph.
No. Block elements inside p are invalid HTML.
Yes. Universal support in every browser including legacy IE.

Structure Readable Content

Practice <p> with single, multiple, and styled paragraphs in the Try It editor.

Try single paragraph →

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.

6 people found this page helpful