Menu
Coddy logo textTech

Line Breaks

Part of the Fundamentals section of Coddy's HTML journey — lesson 8 of 60.

In HTML, the <br> tag is used to create a line break. This tag is useful when you want to start text on a new line without creating a new paragraph. Unlike the <p> tag, which adds a blank line before and after the text, the <br> tag simply moves the text to the next line.

Here's how you can use the <br> tag in HTML:

<p>This is a line.<br>This is another line.</p>

In this example, "This is a line." and "This is another line." will be displayed on separate lines within the same paragraph. The <br> tag is an empty element, which means it doesn't have a closing tag. You just write <br> where you want the line break to occur.

challenge icon

Challenge

Easy

You are given an HTML document with a paragraph. Use a line break to make the text appear like this:

Hello, world!
This is a new line.

Cheat sheet

The <br> tag creates a line break to start text on a new line without creating a new paragraph:

<p>This is a line.<br>This is another line.</p>

The <br> tag is an empty element with no closing tag.

Try it yourself

<!DOCTYPE html>
<html>
    <body>
        <p>Hello, world!This is a new line.</p>
    </body>
</html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Fundamentals