×

HTML <br> tag

HTML is referred to as Hyper Text Markup Language, which is the most popular language for creating Web pages. HTML explains the construction of a Web page. It contains a wide variety of different elements. In Html, there is one of the tags, <br> that is used for adding line break in any paragraph or text.

A line break in a html document  can be made using the HTML br tag.

New paragraph and line breaks in the html text document are not provided by the browser. You can add line breaks in your html document with the help of <br> tag. One carriage returns or break is inserted into the document by <br> tag. No end tag exists for this element.

It is typically used in poems or addresses where line breaks are required. The <br> tag functions similarly to the enter key in a word file if it is included in the HTML code.

Syntax of br tag

Paragraph <br> Paragraph

Example of br tag in HTML

<!DOCTYPE HTML>  
<html>  
<head>  
<title>  
 BR tag  
</title>  
</head>    
<body>    
<h2> Example Of Br Tag </h2>
<p>This Is an Example of Br <br> Tag in a paragraph, <br> use the BR element in <br> your HTML document. When You add line break </p>    
</body>  
</html> 

Output: html-br-tag

Html <br> Tag

Example 2

<!DOCTYPE HTML>  
<html>  
<head>  
<title>  
Example of BR tag in Address  
</title>  
</head>    
<body> <font color="Blue"> <!-The color attribute displays the color of following address in green -->   
<p>Bhajanpura<br>   
Wazirabad Road, <br>  
New Delhi, <br>  
India <br>   
</body>  
</html>    

Output:

Html <br> Tag

As you can see from the above example, a <br> element is included at each point where we want the text to break. The text after the <br> begins again at the start of the next line of the text block.

Styling with CSS

The br> element's sole, clearly stated function is to introduce a line break into a block of text. As a result, there isn't much you can do to style it and it doesn't have any dimensions or visual output of its own.

To increase the space between the lines of text in the block, you can add a margin to the br> elements themselves, but this is bad practise; instead, you should use the line-height property, which was made for that purpose.

Availability issues

In addition to being bad practice, using the br> character to break up paragraphs of text causes issues for users of screen reading software. Although content contained within br> cannot be read aloud by screen readers, the element can be announced to be present. The screen reader user may find this to be both confusing and frustrating.

Use p> elements and CSS spacing properties to manage their spacing.

Why <br> tag is differed from <br/> tag?

There are two ways to use the HTML br tag: br> or br/>. Since closed br tags are supported by both HTML and XHTML.

The self-closing br tag is used to create line breaks in HTML documents.

A self-closing tag (also known as an empty tag) can be used when a tag is used without any space between them. One of these self-closing tags is br does not require the closing tag (/br). Therefore, it follows that when used in HTML, br and br/ will yield the same results.

However, when using XHTML (which is stricter than HTML), it is not permitted to leave tags open (for example, you cannot write just br; you must also close it, but /br doesn't make sense because it is a self-closing tag), so br/ will be used in that situation.

Additionally, br is less efficient as compared to br/ in terms of code organization and readability. As a result, br/ is typically preferred over br.

Browser Compatibility

  • Chrome
  • Firefox
  • Opera Mini
  • Safari (All)
  • Edge

Attributes

The only attributes that apply to the <br> tag are the global attributes. There aren't any attributes unique to the <br> tag.

Conclusion

A line break in a html document can be made using the HTML tag br. A new paragraph and line breaks in the html text document are not provided by the browser. You can add line breaks in your html document with the help of <br> tag.


Related Topics

HTML Attributes

HTML Attributes provide the additional information about HTML elements. Attributes are always specified in the start tag. Attributes usually comes in pairs. lang Attribute This attribute helps in declaring the language...

2 minutes read.

HTML Background Image

Inserting image in HTML An image (technically digital image) in HTML or even in general technical aspects, is a binary representation of visual information. By visual information we mean, in the...

8 minutes read.

Html <colgroup> Tag

A HTML table's column group is specified by the "colgroup" tag. If you want to apply various properties to one or more <col> elements in an HTML table, then you...

4 minutes read.

HTML Date

The input element in HTML has several attributes. One of its attributes is the type attribute which creates a calendar in an order that a user can select a date...

5 minutes read.

HTML <samp> tag

The Samp tag in HTML is used for defining the sample output from the computer program. This tag is a phrase type tag and a container tag that means the...

2 minutes read.

HTML5 Attribute

HTML Attribute HTML attributes are special words that provide additional information about the HTML element or attributes.The element or tags have attributes, which define the element's behavior.It also adds attributes with a start...

3 minutes read.

How to add JavaScript to HTML

JavaScript is one of the most important languages today. It is a high-level, interpreted, lightweight programming language that makes web pages more interactive. It is a language of the web....

5 minutes read.

HTML Id Attribute

The HTML id attribute represents the unique identifier for an element of the HTML document. Each element has its unique identifier. The id attribute is a global attribute that can be...

12 minutes read.

HTML5 Formatting

HTML Formatting HTML Formatting is a method of text formatting for a better appearance and look. HTML allows us to format text without using the CSS. HTML includes a lot of formatting tags....

6 minutes read.

HTML Search Box

The HTML search box is also known as the search bar. It is an input text field that is used to search the content. If the users want to explore...

7 minutes read.

How to insert spaces/tabs in text using HTML/CSS

What is HTML? HTML or HyperText Markup Language is used to design web pages. It was released in 1993. The file extension name for HTML file is “.html”. An HTML file...

4 minutes read.

HTML <section> tag

The section element in HTML is used to define sections in a document. Syntax of Section Tag: <body> <h1>……….</h1> <section> <h2>……….</h2> <p> …………………………</p> </section> <section> <h2>………..</h2> <p>…………………………. <p> </section> </body> Examples of Section Tag Example 1: In this example, we use the HTML "section" element...

3 minutes read.

HTML Nested Table

HTML nested table refers to a table that is created inside another table. The table is in the form of rows and columns. From left to right are called horizontal rows,...

5 minutes read.

HTML <address> Tag

Hyper Text Markup Language, HTML is the best markup language for creating Web pages. HTML consists of a wide variety of elements. In all of these elements, one element is...

4 minutes read.

HTML <select> tag

This tag helps in making the drop-down list on the web page. This is highly used in HTML forms for taking the input from user. You can use the id attribute...

3 minutes read.

HTML Layouts

HTML Layouts HTML templates provide a way for well-managed, well-structured responsive web pages to be organized. We could say that the HTML layout specifies how web pages can be set up....

4 minutes read.

Font tag in HTML

HTML stands for Hypertext Mark-up Language and is used to create web pages and other information that can be later displayed in a web browser. It also consists of a...

4 minutes read.

HTML Youtube

<object> element: It embed the object within the HTML documents and embed plug-ins such as Java applets, PDF readers, Flash Players etc in web pages. Example: <object width="100" height="100" data="bookmark.swf"></object> <embed> element: It defines an embedded...

1 minute read.

What is a Container tag?

In HTML, there are different types of tags or say instructions which make the developer specify various elements in the document and make the browsers understand what to display. Tags in...

5 minutes read.

HTML Forms

Forms are required when we want to collect data from the user. Html forms consists of different fields to take user inputs such as: input, text area, checkbox, password, radio...

4 minutes read.