Skip to content

HTML for greens - HTML

Line break

How do you move text to the next line in an HTML document?

<br>

The above tag (<br>) is used when we want to immediately end a line. You may ask: Why use it? Can't we simply press Enter and move the text cursor to the next line? Well, you can't. Web browsers ignore all line break characters entered with the Enter key (they also ignore placing more than one space next to each other - see: Special Characters). For example, if you enter the following text in an editor:

This is the first line...
and this is the second line.

in the browser, you'll see:

This is first line... and this is second line.

The line will only end automatically when the provided text is too long to fit in a single line. However, if you want to immediately end a line, you can do so by placing the <br> tag where you want the line to end. For example, entering the following in an editor:

This is the first line...<br>
and this is the second line.

will result in displaying the text as:

This is the first line...
and this is the second line.

If you place more than one <br> tag next to each other, you can "go down" several lines, for example:

This is the first line...<br><br><br>
...and this is the next line.

will display:

This is the first line...


...and this is the next line.

Note that the <br> tag itself is not visible on the browser screen. Only the effects of its operation, i.e., ending the line, are visible.

The <br> tag in HTML does not have a closing tag (this is one of the few exceptions)!

Questions and Answers

How to end a line in HTML?

In the HTML language, pressing the Enter key will not cause the text to be displayed on a new line. To do that, you should use the <br> tag.

How to move to the next line in HTML?

Place the <br> tag where you want to end a line of text.

How to move text down in HTML?

To move text down by one line in HTML, insert the <br> tag before it.

How to put text below text in HTML?

To stack two lines of text one below the other, place the <br> tag between them.

Continue reading

To continue the course, go to the previous or next article: