Open In App
Related Articles

HTML br Tag

Improve Article
Improve
Save Article
Save
Like Article
Like

In this article, we will know how to add line-break using HTML <br> tag. The browser does not recognize new lines and paragraph formatting in the text. If you want to start a new line, you need to insert a line break with the help of the <br>. The <br> tag inserts a single carriage return or breaks in the document. This element has no end tag.

Syntax:

<br>

Attributes: This tag accepts an attribute called clear

  • clear: Which indicates where to begin the next line after the break.

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

HTML




<!DOCTYPE html>
<html>
<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

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.

Example: 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

Supported Browsers: 

  • Google Chrome 1 and above
  • Microsoft Edge 12 and above
  • Internet Explorer
  • Firefox 1 and above
  • Safari
  • Opera

Last Updated : 08 May, 2023
Like Article
Save Article
Similar Reads
Related Tutorials