html

What is br in HTML

While working on any text editor like MS-Word, Google docs, etc. we can easily break the line using the enter key. However, this practice will not be applicable on the HTML document. In HTML, the br tag can be used to break a line. The line break phenomenon is quite important to adjust content on the appropriate place of the webpage. This post aims to provide a deep insight into the <br> tag and will demonstrate its usage.

What is <br> Tag in HTML?

In HTML, <br> tag breaks the current line and starts a new line. This practice is helpful while writing multiple paragraphs, quotations, or any text that needs separation from the previous line/text. Here , we have presented an example which shows how an HTML document looks without <br> and with <br> tag.

Code

<html lang="en">
    <head>
        <title>First Document</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <h1>HTML <br> Tag</h1>
        <p style="font-size: 23px;">
            This paragraph is written to showcase the use of <br> tag into the HTML page.
            This paragraph is written to showcase the use of <br> tag into the HTML page.
            This paragraph is written to showcase the use of <br> tag into the HTML page.
            This paragraph is written to showcase the use of <br> tag into the HTML page.
            This paragraph is written to showcase the use of <br> tag into the HTML page.
        </p>
    </body>
</html>

In the above code, we write a paragraph having 5 lines without using the <br> tag. However, we have used the enter key to check how it behaves in HTML.

Output

It is observed that the enter key did not break the line and all the lines are joined with each other.

Let’s use the <br> tag on the same code.

Code

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>First Document</title>
        <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <h1>HTML <br> Tag</h1>
        <p style="font-size: 23px;">
            This paragraph is written to showcase the use of <br> tag into the HTML page.<br>
            This paragraph is written to showcase the use of <br> tag into the HTML page.<br>
            This paragraph is written to showcase the use of <br> tag into the HTML page.<br>
            This paragraph is written to showcase the use of <br> tag into the HTML page.<br>
            This paragraph is written to showcase the use of <br> tag into the HTML page.
        </p>
    </body>
</html>

We take the same code as mentioned above but this time we use <br> tag at the end of each line.

Output

It is clear from this output that <br> tag has divided the text into multiple lines.

That’s all about the br in HTML. You have understood the working and usage of the br in HTML.

Conclusion

In HTML, the <br> tag is used to break the current line. The text written after the <br> tag is printed on the next line. The usage of <br> tag is quite important while writing long paragraphs or text in an HTML file. Apart from understanding what br is, this post has also demonstrated its usage with the help of an example.

About the author

Adnan Shabbir