HTML Line Breaks

We have already seen how after we close a paragraph the web browser automatically starts a new line. But what if we want to insert a line break where there wouldn't automatically be one, or even force a line break in the middle of a paragraph? This is where the line break HTML tag comes in very handy.

The line break tag does not actually surround any of our HTML code, and so its opening and closing tags are combined into one tag <br />. Note that although the space between the br and / is optional, omitting it can cause problems in certain browsers, so it is best to use it just to be on the safe side.

To use the line break tag we just drop it into our text wherever we want to use it, like in the following example:

<title>Using line breaks</title>


<p>This is our first paragraph</p>

<p>This is our second paragraph</p>

<br />

<p>The third paragraph is pushed lower by the line break</p>

<p>We can use line breaks in the <br />
middle of a paragraph or multiple line breaks...
<br /><br /><br /> create a very large gap!</p>


Line breaks are very versatile and we can just drop them into our HTML pretty much wherever we want to alter the spacing of certain elements.