The br tag in HTML

What does the br element do in HTML?

The br element is used to insert a line break or return to a parent element, such as a paragraph, without leaving the parent container.

Do not abuse the line break

The b element creates a line break. It’s easy to overuse this tag to create a style that carries text to the next line without indentation, unlike using the p and ul paragraph tags and lists. As a general rule, the br element should only be used if the line break is itself an integral part of the content.
Often the element is used to represent text as a list:

poetry
addresses
code samples

Verse 1
<p>First line<br>
  Second line<br>
  Third line<br>
  Fourth line</p>
Verse 2
<p>1st line<br>
  2nd line<br>
  3rd line<br>
  4th line</p>
Moving the lines of the poem with the tag br

If you find yourself using br to separate blocks of text, you may need to consider using paragraph p tags or another element. If you use br to create more space between elements, you should use CSS margin.

Verse
<p>First line</p>
<p>Second line</p>
<p>Third line</p>
<p>Fourth line</p>
Author<br>
Description
p {
  margin: 3;
}
Using CSS margin for large indentation

Leave a Comment

Your email address will not be published. Required fields are marked *