The Break (BR) Tag. When Do I Use it?

In HTML5
2 min read

The <br> tag is used to create a line break in the text. It’s one of the simplest HTML tags and has no closing tag, meaning that you don’t need to use </br> it at the end of the line.

Here is an example of how to use the <br> tag:

    <p>This is a line of text.</p>
    <p>This is another line of text.</p>
    <p>And here's a third line of text.</p>
  

In this example, each <p> tag creates a new paragraph, and the <br> Tag is used to create a line break between each paragraph. This will result in the following output:

    <p>This is a line of text.</p>
    <br>
    <p>This is another line of text.</p>
    <br>
    <p>And here's a third line of text.</p>
  

As you can see, the <br> Tag creates a new line within the same paragraph. It is important to note that the <br> tag does not create a new paragraph but creates a line break within the same paragraph.

The following attributes can be applied to the <br> tag:

  • Clear: This attribute specifies whether the line break should clear any floats that are present in the container. The possible values for this attribute are “left,” “right,” “all,” and “none.”
  • Title: This attribute adds a tooltip to the element.

For example, if you wanted to create a line break that clears any left floats and has a tooltip that says “Line Break,” you would use the following code:

    <br clear="left" title="Line Break">
  

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Carlos Baez

Subscribe now to keep reading and get access to the full archive.

Continue Reading