DEV Community

Share Point Anchor
Share Point Anchor

Posted on • Originally published at sharepointanchor.com on

HTML <br> Line Break Tag

In HTML, the br tag defines a Line break. This tag creates a line break in an HTML document. If you place the br tag in the HTML document it works the same as pressing the “Enter” key. It is useful for writing a poem or an address.

Estimated reading time: 3 minutes

Syntax:

The br tag doesn’t contain a closing tag in an HTML document. But in XHTML , it consists of both opening br tag and closing br tag.


Text <br> text

Enter fullscreen mode Exit fullscreen mode

Note: Do not use the br tag to create margins between two paragraphs. Use the CSS margin property to control their size.

Sample of the HTML br Tag:


<!DOCTYPE html>
<html>
  <head>
    <title>Line Break Tag</title>
  </head>
  <body>
    <h1>Example of the <br> tag in HTML</h1>
    <p> Inside the paragraph, put the <br /> tag, <br> to transfer a part of the text to another line.</p>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Result:

Result

Sample of
tag for writing an address:


<!DOCTYPE html>
<html>
  <head>
    <title>Line Break Tag</title>
  </head>
  <body>
    <h3>Address:</h3>
    <p>Gloria,<br> 123 C, Elvin Avenue,<br> Mountain View,<br> California.</p>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Result:

Result

Attributes:

The <br> Line break tag in HTML supports both Global Attributes and the Event Attributes.

th, td{ padding: 20px; }

Attributes Value Description
clear The clear attribute specifies how to process the next line if the text wraps around the floating element.(Not used in HTML5)
all Helps to reverse the flow around the element from the right and left edges at the same time.
left It will reverse the flow from the left side of the element placed after the br tag.
right This value helps to reverse the flow from the right side.
none It will cancel the action of an attribute.

Browser Support:

Browser Support

Related Articles:

The post HTML br Line Break Tag appeared first on Share Point Anchor.

Top comments (0)