Here’s a complete, detailed guide on how to add space between paragraphs in HTML, covering multiple methods using CSS, HTML attributes, and best practices.
In this article:
1. Default Behavior of Paragraphs
In HTML:
<p>Paragraph 1</p>
<p>Paragraph 2</p>
- Browsers automatically add some vertical spacing (margin) between paragraphs.
- The exact space depends on the browser’s default stylesheet.
To customize spacing, you need CSS.
2. Using CSS margin Property (Recommended)
The margin property adds space outside an element.
Example:
<p style="margin-bottom: 20px;">Paragraph 1</p>
<p>Paragraph 2</p>
Explanation:
margin-bottom: 20px;→ adds 20 pixels of space below the first paragraph
2.1 Internal CSS for All Paragraphs
<head>
<style>
p {
margin-bottom: 15px; /* space between paragraphs */
}
</style>
</head>
<body>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
</body>
- Applies to all
<p>elements - Keeps your HTML clean
2.2 External CSS
/* style.css */
p {
margin-bottom: 20px;
}
<link rel="stylesheet" href="style.css">
<p>Paragraph 1</p>
<p>Paragraph 2</p>
- Best practice for large projects
3. Using padding Property (Alternative)
- Padding adds space inside an element.
- Not usually recommended for spacing between paragraphs because it affects background inside
<p>.
<p style="padding-bottom: 15px;">Paragraph 1</p>
<p>Paragraph 2</p>
- Works but margin is preferred for spacing between elements
4. Using <br> Tags (Not Recommended)
You could add extra line breaks:
<p>Paragraph 1</p>
<br>
<p>Paragraph 2</p>
Disadvantages:
- Not semantic
- Harder to maintain
- Should only be used for line breaks inside a paragraph, not spacing between paragraphs
5. Using CSS Classes for Custom Spacing
<p class="spaced">Paragraph 1</p>
<p class="spaced">Paragraph 2</p>
<style>
.spaced {
margin-bottom: 25px;
}
</style>
- Useful when not all paragraphs should have the same spacing
6. Using Relative Units (em, rem, %)
Instead of pixels, you can use relative units for responsive design:
<style>
p {
margin-bottom: 1.5em; /* 1.5 times the font size */
}
</style>
- Keeps spacing proportional to text size
7. Using line-height (Optional)
line-heightincreases space within a paragraph, not between paragraphs
p {
line-height: 1.8; /* increases vertical spacing within the paragraph */
}
- Combine with
margin-bottomfor better readability
8. Full Example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Paragraph Spacing Example</title>
<style>
p {
margin-bottom: 20px; /* space between paragraphs */
line-height: 1.6; /* line spacing inside paragraph */
font-family: Arial, sans-serif;
}
</style>
</head>
<body>
<p>This is the first paragraph. Notice the space below it.</p>
<p>This is the second paragraph, spaced properly using CSS.</p>
<p>Third paragraph with consistent spacing.</p>
</body>
</html>
9. Summary
| Method | How to Use | Notes |
|---|---|---|
CSS margin-bottom | p { margin-bottom: 20px; } | Best practice for spacing between paragraphs |
CSS padding-bottom | p { padding-bottom: 20px; } | Adds space inside paragraph; less preferred |
<br> tag | <br> | Not recommended for paragraph spacing |
| CSS classes | <p class="spaced"> | Useful for selective spacing |
| Relative units | margin-bottom: 1.5em; | Responsive, scales with font size |
line-height | line-height: 1.5; | Adjusts spacing inside paragraph |
✅ Best Practice: Use CSS margin-bottom for consistent spacing between paragraphs and combine with line-height for readability.
Other Courses:



