<br> Tag in HTML
The <br> tag is used to insert a line break in HTML. It is an empty tag, meaning it does not require a closing tag. This tag is particularly useful when you want to create a break between lines of text or other content, without using a new paragraph.
Key Points on <br> Tag:
- The
<br>
tag is used to break a line of text and move content to the next line. - It is commonly used within paragraphs, divs, or other block-level elements to add space or break up content.
- It does not add extra space between lines; it just moves the following content to the next line.
- It does not require a closing tag. Just
<br>
is sufficient.
Syntax of <br> Tag:
Syntax Example
<br>
Example of <br> Tag in HTML:
This example demonstrates how the <br>
tag works to create line breaks within content.
Code Example
<p>This is the first line.<br>
This is the second line after a break.<br>
This is the third line.</p>
Output
This is the first line.
This is the second line after a break.
This is the third line.
This is the second line after a break.
This is the third line.
The <br>
tag is a simple but useful element when you want to add a line break within text. However, it should be used sparingly, as it is generally better to use other tags like <p>
(paragraphs) or <div>
(block elements) for larger sections of content that need separation.