×

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 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 &lt;center> Tag

The term HTML refers to Hyper Text Markup Language. The most widely used markup language for making web pages is HTML. A structure of web page is described in HTML....

3 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.

How to create a link with no underline in HTML

In HTML, an anchor tag (<a>) is a Styled Container tag, which means when a hyperlink is created using this, browsers, by default, display the link by applying some styles...

5 minutes read.

HTML <video> Tag

The Video tag in HTML is used to play video on a media player on the web page. We can also insert an audio by the video tag, but audio...

6 minutes read.

HTML <style> tag

The section of information that we want to style is contained in html style tag. It includes CSS, which is used to design the text and images in the web page. Syntax: <head> <title>…………....

3 minutes read.

HTML5 Tags

HTML5 Tags A list of newly included tags is provided in HTML5. These HTML 5 tags (elements) provide a better structure for the document. This list shows description of all HTML...

3 minutes read.

What does HTML stand for?

HTML stands for Hyper Text Markup Language. We use this markup language to design a web page. Web browsers use this language to showcase text, videos, images, audio and other...

6 minutes read.

HTML <strike> tag

The HTML <strike> tag is used to specifies strikethrough text. The tag is deprecated now and <del> tag is used in HTML files instead of it. All the global and...

2 minutes read.

HTML Hide Element

The HTML hide element is used to hide the element. We place the hidden attribute inside those elements which we want to hide. The hidden attribute is a Boolean attribute. The...

3 minutes read.

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...

4 minutes read.

HTML Font Size

The HTML <font> tag uses the size attribute to specify the size of the text. We can set the size attribute’s value from 1 to 7. The default size of...

4 minutes read.

Div Tag in HTML

In HTML, ‘div’ is a tag that specifies division or section in HTML document. But before going in detail of it, let’s first understand about tags in HTML. The tag...

8 minutes read.

HTML Button Disabled

The HTML <button> element has many attributes, one of them is the disabled attribute. The button on which you apply the disabled attribute will not work, or we can say...

4 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.

How to Create a Portfolio Gallery using HTML and CSS?

First, before starting this, the user should know some of the basics of HTML and CSS to create a portfolio gallery. To add more functionality to the website, we can also...

7 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 Data Tag

HTML Data Tag: The HTML < data > tag is used to transmit its content to a machine-readable version. The data are presented in a particular format. It is useful...

3 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.

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.