HTML <p> Tag – Paragraphs
📌 Introduction
The <p> tag is used to define a paragraph of text in HTML.
It is one of the most commonly used tags for writing readable content on a webpage.
🧱 Syntax
<p>Your text goes here</p>
💡 Example
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<h1>About HTML</h1>
<p>HTML is the standard language used to create web pages.</p>
<p>It helps structure content like text, images, and links.</p>
</body>
</html>
🖥️ Output Explanation
- Each
<p>creates a separate block of text - Browsers automatically add space above and below paragraphs
- Paragraphs are displayed in a clean readable format
🎯 Why <p> is Important
- Organizes text into readable sections
- Improves user experience
- Used in blogs, articles, documentation, and websites
⚠️ Important Rules
Do NOT leave
<p>unclosed:<p>This is wrong ❌</p>Always close it properly:
<p>This is correct ✔</p>
💡 How Browsers Handle <p>
Even if you write multiple spaces or line breaks in HTML:
<p>Hello World</p>
👉 The browser will still show: Hello World
✔ HTML ignores extra spaces inside paragraphs
🎯 Best Practices
- Keep paragraphs short and clear
- Use multiple
<p>tags instead of one long block - Don’t use
<br>for spacing—use CSS instead
🚫 Common Mistakes
- Using
<p>for layout ❌ - Forgetting to close
<p>❌ - Putting block elements like
<div>inside<p>❌
🧪 Mini Exercise
Create a page with:
- A heading using
<h1> - Three paragraphs:
- About yourself
- Your skills
- Your goals