How to Write a Paragraph in HTML
Each <p> element is one paragraph. The browser puts space above and below it, and wraps its text to fit the window, ignoring the line breaks you typed in your code.
Syntax
<p><text></p>
| Part | What it does |
|---|---|
<p> | Starts a paragraph. |
<text> | The paragraph's text, which can include elements such as strong or a link. |
</p> | Ends the paragraph. |
MDN's p page describes the element.
The Example
The example has two paragraphs about opening hours. In the code, the second one is split over two lines, to show what the browser does with that line break.
Step 1: Write the Code
Create a file named index.html in a text editor, such as Visual Studio Code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Opening hours</title>
</head>
<body>
<p>The office opens at 9:00.</p>
<p>The kitchen closes at 15:00.
Lunch is served from 12:00.</p>
</body>
</html>
Step 2: Open It in a Browser
Double-click index.html. It opens in your browser:

The screenshot comes from Chromium 159, the open-source browser that Chrome is built on.
What Happened
- Each
pis its own block, with 16 pixels of space above and below it. - The line break in the second paragraph disappeared. The browser turned the break and the spaces after it into a single space, so the paragraph is one line, 19 pixels tall, the same as the first.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| Pressing Enter in the code to start a new line | The line break doesn't show on the page | Use br for a new line, or a new p for a new paragraph |
Putting a div inside a p | The browser ends the paragraph early: <p>Start <div>block</div> end</p> became <p>Start </p><div>block</div> end<p></p> | Use span inside a paragraph, or put the div outside it |
| Typing several spaces to push words apart | They collapse into one space | Use CSS for spacing |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Text you typed on two lines shows on one | The browser ignores line breaks in the code | Add br where the line should break |
An empty paragraph appears after a div | The div was inside a p, so the browser closed the p early | Move the div out of the paragraph |
FAQ
How do I break a line without starting a new paragraph?
Use <br>. In a test, Line one<br>Line two made the paragraph two lines, 37 pixels tall instead of 19. br has no closing tag.
How do I change the space between paragraphs?
With CSS: the space comes from the paragraph's margin, which was 16 pixels above and below.
Does a p need its closing tag?
Close it. Leaving it out is allowed in some places, but the closing tag shows exactly where the paragraph ends, for you and for the browser.
Conclusion
Put each paragraph in its own p, use br for a line break inside a paragraph, and keep block elements such as div out of it. The browser takes care of the spacing and the wrapping.
Additional Resources
- p: The Paragraph element, on MDN.
- br: The Line Break element, on MDN.
