Signup/Sign In

HTML br Tag

The HTML <br> tag is used to define a line break in an HTML Document. A line break is nothing but moving on to the next line to add some space between two different sentences or paragraphs or any other HTML element or webpage components.

HTML br Tag example

Line Breaks are required to distinguish between different sections or parts of any text on a webpage. Although the <p> tag or the paragraph tag can be used for doing so with text, the line break tag can be used for this purpose along with adding a line break anywhere.

As an ill practice, the line break is also used by many developers to add additional space after any webpage component like heading, image, etc. But we would recommend using the CSS margin for that purpose.

One thing that is important to note is line break is not used to create another paragraph, it simply breaks the existing line and starts with a new line. So the line breaks are only used to break a continuing line.

HTML <br> Tag - Syntax and Usage

The <br> tag is an empty tag. It does not require any end or closing tag.

Required syntax for the same is given below:

Content here...<br/>content....

You can write it as <br> or <br/> both the syntax are fine. The second one, i.e. <br /> is syntactically perfect, as every empty tag should have a / inside it before the closing angular bracket >, to specify its end as there is no specific end or closing tag in it.

HTML <br> Tag Basic Example

Below we have a basic example for a clear understanding of <br> tag:

HTML <br> Tag Attributes

This element does not have any specific attributes although this element supports Global attributes and Event attributes.

Using the style attribute, we can define custom styling for the <br> tag, the most popular use case is to increase or decrease the space that a line break adds after breaking a line. We can use CSS margin for doing so, for example:

br {
    margin-top: 15px;
    margin-bottom: 15px;
}

Note: There is no Default CSS styling added for this tag.

Browser Support for HTML <br> tag

Following browsers support this attribute:

  • Firefox 1+

  • Google Chrome 1+

  • Internet Explorer 2+

  • Apple Safari 1+

  • Opera 2.1+



About the author:
Aspiring Software developer working as a content writer. I like computer related subjects like Computer Networks, Operating system, CAO, Database, and I am also learning Python.