0
0
HtmlHow-ToBeginner · 3 min read

How to Create a Paragraph in HTML: Simple Guide

To create a paragraph in HTML, use the <p> tag to wrap your text. This tag tells the browser to display the text as a separate paragraph with space above and below.
📐

Syntax

The <p> tag defines a paragraph in HTML. It starts with <p> and ends with </p>. Text inside these tags is treated as one paragraph.

Browsers automatically add space before and after paragraphs for readability.

html
<p>This is a paragraph.</p>
Output
This is a paragraph.
💻

Example

This example shows two paragraphs created with the <p> tag. Each paragraph appears on its own line with space between them.

html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Paragraph Example</title>
</head>
<body>
  <p>This is the first paragraph.</p>
  <p>This is the second paragraph.</p>
</body>
</html>
Output
This is the first paragraph. This is the second paragraph.
⚠️

Common Pitfalls

One common mistake is forgetting to close the <p> tag, which can cause layout issues. Another is using multiple <br> tags to create paragraphs instead of using <p>.

Always use <p> for paragraphs to keep your HTML semantic and accessible.

html
<!-- Wrong way -->
<p>This is a paragraph without closing tag
<p>This is another paragraph.</p>

<!-- Right way -->
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
📊

Quick Reference

  • <p>: Starts a paragraph
  • </p>: Ends a paragraph
  • Browsers add space before and after paragraphs
  • Use paragraphs to group related sentences

Key Takeaways

Use the

tag to create paragraphs in HTML.

Always close your

tags to avoid layout problems.

Browsers add space around paragraphs automatically.
Avoid using
tags to separate paragraphs.
Paragraphs help organize text for better readability and accessibility.