Open In App

HTML <br> Tag

Improve
Improve
Like Article
Like
Save
Share
Report

HTML <br> tag is a powerful tool for controlling the layout of your text. Unlike word processors, web browsers don’t automatically recognize new lines or paragraph formatting. This is where the <br> tag comes into play.

The <br> tag is a self-closing element, meaning it doesn’t require a closing tag. It’s commonly used in addresses, poetry, or any situation where a line break is needed for better readability.

Note: The <br> tag also supports the Global Attributes and Event Attributes in HTML.

Syntax:

<br>

Attributes:

Attribute Value

Description

clear

It indicates where to begin the next line after the break.

Examples of HTML br Tag

1. Using br Tag to Line Break the Content:

Example 1: In this example, we use <br> tag in p tag to line break the content.

HTML
<!DOCTYPE html>
<html lang="en">

<head>
    <title>HTML5 br Tag</title>
</head>

<body>
    <h2>GeeksforGeeks</h2>

    <!--br tag is used in below paragraph-->

    <p>Hi Geeks!
        <br>Welcome to GeeksforGeeks
    </p>

</body>

</html>

Output:

HTML br tag example

HTML br tag

Let us consider an example. Type the following HTML code does not use the <br> tag in notepad, save the document as an HTML file, and open it in a browser. You will notice that the text shows line breaks at four instances, the browser displays the entire text as a single paragraph.

2. Using br Tag to Add Line Break:

Example 2: This example explains the use of the <br> tag to add the line-break.

HTML
<!DOCTYPE html>
<html>

<body>
  <h1>GeeksforGeeks</h1>
  <h2>br Tag</h2>
  <!-- br tag -->
  <p>
    GeeksforGeeks:<br>
    Computer science portal
  </p>
</body>

</html>

Output:

HTML br tag example output

HTML br tag

Supported Browsers: 

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 4

Last Updated : 27 Mar, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads