FactorPad
Build a Better Process

HTML br Tag Reference and Examples

The line break tag creates a carriage return within a block of text. Learning the XML form is worth the extra effort here.
  1. About - Understand the purpose of the br tag.
  2. Syntax - Describe how it is used.
  3. Settings - View required and optional attributes plus default behaviors.
  4. Examples - Review br code examples.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
The line break tag often confuses beginners because it doesn't have a closing tag. Learn more below.

Outline Back Tip Next

/ factorpad.com / tech / html5 / reference / html-br-tag.html


An ad-free and cookie-free website.


HTML br Tag

Beginner

The <br /> tag's primary purpose is to add a line break within a block of text.

HTML Tags Reference

1. About the HTML br tag

The <br /> tag only occurs in the <body>, so the visible section of the document. From there it is normally found within a paragraph, so in a <p> element.

Its purpose is to add a carriage return, which is also called a line break or new line across programming languages. You might require a break when writing a poem or a mailing address, although the <address> element might be a better option.

As an inline-element, a break can be placed anywhere on a line. It doesn't take up the whole space of its parent element as a block-level element would.

So the <br /> tag is about the display of text, not document structure.

2. Syntax for the HTML p tag

The <br /> element requires only one tag. There are a handful of other single-tag elements, like <meta />, <hr /> and <img />. These may also be referred to as "empty tags".

Unlike other most other tags, the <br /> tag has no attributes. Of course global attributes apply, as they do with all elements.

HTML vs. XML

Technically under HTML5, the tag can be input simply as <br>, but since it is so similar to the XML and XHTML-conforming standard of <br />, I recommend learning the longer form here, especially as you progress towards learning the more advanced markup language XML, the eXtensible Markup Language.

The importance of XML has grown over recent years with the popularity of automated forms of web publishing like blogs and social feeds that connect to databases.

Sample HTML input
<body> <p><strong>Write Poetry. We Wish He Could.</strong></p> <p> If he could write a nice poem,<br /> this sure would be more fun.<br /> The way it's written now,<br /> he won't impress anyone.<br /> </p> <p>:]</p> </body>

HTML code input above will appear as shown below.

Sample HTML output

Write Poetry. We Wish He Could.

If he could write a nice poem,
this sure would be more fun.
The way it's written now,
he won't impress anyone.

:]

3. Settings for the HTML br tag

As with all tags, Global Attributes can always be set.

Attributes and values for the br tag

The <br /> element doesn't have any of its own attributes, or they would be detailed here.

Default behaviors

Each user-agent (browser) has its own stylesheet per se. This dictates how that browser styles each element by default. The Chrome browser styles the <br /> element using the following specifications.

br { display: inline; height: auto; width: auto; }

4. Examples of the HTML br tag

Example 1 - Create a break for an address

The following HTML code will create line breaks for an address block.

<html> <head></head> <body> <p> Doc Brown<br /> 1640 Riverside Drive<br /> Hill Valley, CA </p> </body> </html>

Learning takes practice. Type these lines into a text file, save it with an .html extension and open it in a browser.

After that, start taking notes and writing in HTML to gain experience.


Other Related HTML Content

The <br /> tag sits in a paragraph element, and that sits in the body element.


What's Next?

See what else you can learn for free at our YouTube Channel. If you want updates, follow @factorpad on Twitter.

Outline Back Tip Next

/ factorpad.com / tech / html5 / reference / html-br-tag.html


html br tag
html line break
html break
html br
br tag
what is the html br tag
br element
html br element
break line
html line feed
examples of the html br tag
new line html
how to add a new line html
line break tag
html br examples
html br reference
html carriage return
html br tag defaults

A newly-updated free resource. Connect and refer a friend today.