HTML Paragraphs & Line Breaks
HTML Paragraphs & Line Breaks
The HTML paragraph tag <p> and the line break tag <br> are two of the most frequently used elements for structuring text content — but they serve very different purposes and are often misused by beginners.
The Paragraph Element
The <p> tag defines a block of text as a paragraph. Browsers automatically add spacing (margin) before and after each paragraph:
<p>This is the first paragraph.</p>
<p>This is a second, separate paragraph.</p>The Line Break Element
The <br> tag inserts a single line break within a block of text, without starting a new paragraph. It is a void element and never needs a closing tag:
<p>123 Main Street<br>
Springfield, USA<br>
ZIP: 12345</p><p> vs <br>: When to Use Which
- Use
<p>for distinct blocks of content — a new idea, topic, or thought. - Use
<br>sparingly, only for genuine line breaks inside a single block of related content, like a mailing address or a poem. - Never use multiple
<br>tags in a row to create spacing — that's a job for CSSmarginorpadding.
How HTML Handles Whitespace
One of the most important things to understand: HTML collapses multiple spaces, tabs, and line breaks in your source code into a single space when rendered in the browser. This is why you can't just press Enter in your code to create a new line on the page — you need an actual <p> or <br> tag.
<p>This text has extra spaces
and line breaks in the source code.</p>
<!-- Renders as: This text has extra spaces and line breaks in the source code. -->Key Takeaways
<p>creates a distinct paragraph block with automatic spacing.<br>inserts a single line break within a block — it's a void element.- Don't stack multiple
<br>tags for spacing; use CSS instead. - HTML collapses whitespace, so line breaks in your source code don't affect rendering.
Press Run to execute.
Press Run to execute.
Use a single paragraph with br tags to format the following as a properly line-broken address: Jane Doe, 456 Oak Avenue, Denver, CO 80202.
Press Run to execute.
This is a self-check — compare your result with the expected output above.
Was this page helpful?