The <br> tag in HTML is used to create a line break in the text, causing the content that follows it to appear on a new line.
- It is an empty (void) tag and does not require a closing tag.
- It is used within text content to break lines without starting a new paragraph.
- It should be used sparingly, as CSS or proper layout elements are preferred for spacing.
<!DOCTYPE html>
<html>
<body>
<p>Dear Reader, <br>This is printed after a line break.</p>
</body>
</html>
Adding Line Breaks in Structured Content
Used to insert line breaks within structured text without disrupting the overall layout or creating new blocks.
<!DOCTYPE html>
<html>
<body>
<p>
Hello, welcome to GeeksforGeeks<br>
We hope you enjoy browsing.<br>
Feel free to reach out with any questions.<br>
Have a great day!
</p>
</body>
</html>
- <p> element renders a paragraph of text on the webpage.
- <br> tag inserts inline line breaks without creating new paragraphs.
- <body> contains all visible content displayed by the browser.