A quick primer to HTML <br> tag.
HTML br tag usage – The Line Break Element
The HTML tag
<br> is a stand-alone or singular tag which expands as “break”. It is popularly known as the line break element.
It is actually a utility tag which is often used to put link-breaks between pieces of text. Its sole purpose is to shift the next fragment of text to a new line. The tag comes in handy when marking up address and adding poems, songs, and prose.
We don’t usually make utility tags like
<br> presentable with the help of CSS. The reason being that it serves the content and not the thematic purposes.
The line break tag is not made for declaring the thematic separation of groups. It should always be the part of content rather than the structure.
Below given code demonstrates a wrong implementation of the line break tag. One should avoid using the below given or similar usage of
<p><label>Name: <input type="text"></label><br> <label>URL: <input type="url"></label></p>
The above code can be corrected by rewriting and removing the unnecessary usage of the
<br> tags and adding a separate
<p><label>Name: <input type="text"></label></p> <p><label>URL: <input type="url"></label></p>
Correct usage of the br tag
Here is one example of an address element which makes appropriate use of
<br> to add line-breaks for an address-like format:
<address>John Doe<br> 445 Mount Eden Road<br> Mount Eden, Auckland.</address>
Sometimes people add a forward slash inside the br tag (
<br/>), which looks okay from the XHTML perspective.
Although these slashes seem totally useless from the HTML5 perspective, as HTML5 doesn’t require slashes for self-closing for stand-alone tags.