Line Break Tag
intermediatePart of HTML Content & Structure
Theory
The <br> element inserts a line break within text. It is a void element — use it without a closing tag.
When to Use <br>
Use <br> when the line break is part of the content, not the structure. Common use cases:
- Poems and song lyrics
- Mailing addresses
- Code snippets displayed with
<pre> - Creative formatting where lines must break at specific points
When Not to Use <br>
Do not use <br> to create spacing between paragraphs — use <p> with CSS margins instead. Do not use multiple <br> tags for layout; that is what CSS padding and margin are for. Overusing <br> indicates poor structural markup.
Comparison with <p>
A paragraph <p> represents a block of related text with automatic spacing. A <br> is an inline break within text. Think of <br> as a soft return within the same paragraph, not as a new paragraph.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Line Break Demo</title>
</head>
<body>
<h1>A Poem</h1>
<p>
Roses are red,<br>
Violets are blue,<br>
HTML is fun,<br>
And so are you!
</p>
<h2>Contact</h2>
<p>
John Doe<br>
123 Main Street<br>
Springfield, IL 62701<br>
USA
</p>
</body>
</html>Exercises
Format an Address and a Poem
Create an HTML page with two sections. The first section has an h2 'My Address' with your address using br tags. The second has an h2 'Favorite Poem' with a short 4-line poem using br tags.
Expected Output:
A page with two sections: a formatted address (each line separated by br) and a 4-line poem (each line separated by br).