Last Updated: February 25, 2016
·
425
· alcedo

A common mistake in using the <br /> tag

Before that, a quick quiz, which of these are inline elements?

a  eg: <a href ="" >)
div
span
br
p
img
strong
form

Ans: a, span, br, img, strong ( As a recap, an inline element is one that "doesn't mind" having elements on the LHS and RHS of it. In contrast, a block element doesn't like to have elements beside it )

I guess the tricky part of that question is whattt? <br> is an inline element ?! After all, you probably have seen countless of webpages doing stuff like this:

hello ! </p>
<br />

world </p>

So one might eventually subconsciously think that <br /> is a block element. The semantically correct way to use a <br /> element is infact to use it within the

element to create new lines.

Read More From:
When to use

vs. <br>

So what if I want to create an empty space between two block elements ?

Off hand, I would suggest using the style attribute as a one off thing , or defining a CSS class / id with the required margin spacing for a more uniform look.