Line Break Tag
To insert a line break in your HTML document, you can utilize the
<br> tag.
The <br> tag is used to insert line
breaks in text or paragraphs. When the browser encounters it, the content
that follows starts on the next line.
How to use the <br> tag?
The syntax for the <br> tag looks like
this:
<br>
The <br> tag is an empty element,
meaning it does not require a closing tag. It is commonly used when a
line break is part of the content itself and needs to be preserved.
Basic Example
A simple example of using <br> inside a paragraph is:
<p>
Hello, ShadowCraft!<br>
Welcome to the HTML tutorial.
</p>
In this example, the second line begins after the
<br> tag.
Hello, ShadowCraft!
Welcome to the HTML tutorial.
Using <br> in Addresses
The <br> tag is particularly useful when formatting
content where each line has meaning, such as a postal address.
<p>
ShadowCraft HQ<br>
Main Street<br>
Bihar, India
</p>
Each <br> moves the next piece of content to a new line
without creating a separate paragraph.
Using <br> in Poems and Similar Text
Line breaks can also be useful when the original line structure of the content matters, such as in a poem or another piece of formatted text.
<p>
The first line begins here.<br>
The second line follows here.<br>
And the third line comes next.
</p>
<br> vs <p>
The <br> and <p> tags serve different
purposes. A paragraph creates a separate block of textual content, while
<br> simply moves the following content to the next
line.
<p>This is one paragraph.</p>
<p>This is another paragraph.</p>
Compared with:
<p>
First line.<br>
Second line.
</p>
In the first example there are two separate paragraphs. In the second, both lines belong to the same paragraph.
When Should You Use <br>?
- Use
<br>when an intentional line break is part of the content. - It can be useful for addresses, poems, or other content where line structure matters.
- Use
<p>when you need separate paragraphs or blocks of text. - Use CSS for visual spacing and layout instead of repeated line breaks.
Video Tutorial
Here is a quick video showing how to use the
<br> tag:
Quick Summary
<br>inserts a line break inside content.- It is an empty HTML element and does not require a closing tag.
- It is useful when preserving meaningful line structure is important.
- Use CSS instead of repeated
<br>tags for layout and spacing.