0
0
HTMLmarkup~5 mins

Line breaks and horizontal rules in HTML

Choose your learning style9 modes available
Introduction

Line breaks and horizontal rules help organize content visually. They make text easier to read and separate sections clearly.

When you want to start a new line without starting a new paragraph.
When you want to add a visible line to separate different parts of a page.
When you want to improve readability by breaking long text into smaller parts.
When you want to create a simple divider between topics or sections.
When you want to control spacing in text without extra paragraphs.
Syntax
HTML
<br>
<hr>
<br> creates a line break, like pressing Enter once in a text editor.
<hr> creates a horizontal line across the page to separate content.
Examples
Adds a line break so the second sentence starts on a new line.
HTML
This is line one.<br>This is line two.
Inserts a horizontal line between two paragraphs.
HTML
First paragraph.<hr>Second paragraph.
Two line breaks create an empty line space between words.
HTML
Hello<br><br>World
Sample Program

This page shows how <br> moves text to a new line inside a paragraph. The <hr> creates a horizontal line to separate sections.

HTML
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Line Breaks and Horizontal Rules</title>
</head>
<body>
  <h1>Welcome to My Page</h1>
  <p>This is the first line.<br>This is the second line right below it.</p>
  <hr>
  <p>Here is a new section separated by a horizontal line.</p>
</body>
</html>
OutputSuccess
Important Notes

The <br> tag is empty and does not need a closing tag.

The <hr> tag is also empty and creates a visible line by default.

Use <br> sparingly to avoid messy text layout; paragraphs are usually better for spacing.

Summary

<br> adds a line break inside text.

<hr> adds a horizontal line to separate content.

Both tags help organize and improve the look of your web page.