In this article, we will know how to add line breaks using an 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 <be>.
It’s a self-closing tag and doesn’t require any type of closing tag. It is used for addresses, poetry, or in situations where line breaks are needed.
Notes: The <br>
 tag also supports the Global Attributes and Event Attributes in HTML.
Syntax:
<br>
Attributes:
clear
|
It indicates where to begin the next line after the break.
|
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 >
< p >Hi Geeks!
< br >Welcome to GeeksforGeeks
</ p >
</ body >
</ html >
|
Output:
HTML 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 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 >
< p >
GeeksforGeeks:< br >
Computer science portal
</ p >
</ body >
</ html >
|
Output:
HTML tag
Supported Browsers:Â
- Google Chrome 1
- Edge 12
- Firefox 1
- Opera 15
- Safari 4
Last Updated :
02 Jan, 2024
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...