Which br tag should I use?

The “BR” tag began out as <br> and went to <br /> when HTML was moving towards XML called XHTML. XML is it’s own coding language used to structure information and needs that tags (elements) be closed. So HTML having tags like <img> <hr> and <br> required a type of hybrid variation for a couple of years.

The WC3 individuals who regulate HTML did an about face and launched HTML5 dropping the entire XML thing. Now most contemporary web browsers check out both variations so that older web pages written in XHTML do not break. Exactly what is commonly referred to as in reverse compatibility. Today coders use <br> (again).

Here it remains in higher detail:
( keep in mind you ought to be writing code in HTML5).

In HTML (approximately HTML 4): use <br>

In XHTML: <br /> is chosen. Can also utilize <br/> or <br></br>

In HTML 5: <br> is preferred, but <br/> and <br /> is likewise acceptable.

Notes:.

<br></br> is not legitimate in HTML 5, it will be thought of as two line breaks.
XHTML is case delicate, HTML is not case sensitive.
For backward compatibility, some old browsers would parse XHTML as HTML and fail on <br/> but not <br />
< br/ > In conclusion; new tags are presented and deprecated with every version of HTML. Keeping up is a labor of love. http://www.w3.org/ is the final word and referral but an extremely challenging website to read.

Top