In this section, we will learn what HTML <br> element is and how it works.
HTML Line break: What is <br> Tag in HTML?
HTML <br> element stands for break and is used to break lines or add new empty lines. Basically, anytime we want to add a new line or break the current line, we can use the <br> element.
For example, let’s say you have two paragraph (created via HTML <p> element) and want to put 2 empty lines between these paragraphs in order to create more spaces in between; this is where we can use the <br> element two times in a row and as a result, two new lines will appear right where the two <br> elements are used.
Or let’s say we have a paragraph created via <p> element and inside that paragraph we want to break a few sentences! This is another use case for <br> element! All we need to do is to put the <br> element anywhere in the paragraph where we want this break of sentence to happen.
HTML <br> Tag Syntax:
HTML <br> Tag Values
HTML <br> element is a single element and does not take any value.
Simply put, the element anywhere on the page where you want to break the line.
Example: break line in HTML
See the Pen break line in HTML by Omid Dehghan (@odchan1) on CodePen.
Here for the first paragraph we just added new lines to a few sentences in the Editor but as you can see from the result, browsers didn’t care about these broken lines in the editor and simply attached the lines of the first paragraph as if there were no broken lines at all!
But in the second paragraph, anywhere in the sentences that we used <br> element, there were a line break in the output as well.