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
EasyYou 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>This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
2Text and Formatting
HeadingsParagraphsLine BreaksBold and Italic TextBold and Italic AgainRecap - Formatting8Forms and Inputs Part 1
Form BasicsText InputsInput AttributesPassword FieldLabels for InputsRecap - Basic Form11Event Registration Page
Project OverviewHeader Section9Forms and Inputs Part 2
Radio ButtonsCheckboxesDropdownsButtonsButtons in FormsRecap - Forms #1Recap - Forms #2