<br> or <br/>, is there a difference?

+9 votes
Both display the same.  Is there any technical reason to prefer one over the other?
in WikiTree Tech by Dan Thompson G2G6 Mach 2 (22.1k points)

1 Answer

+14 votes
Best answer
Theoretically, yes .... practically, no (at least for the moment).

The HTML tag that forces a line break (I think of the "br" as meaning "break" - it helps remember the tags when I associate a word with them that suggests their action) used to be <br>.  When HTML version 4 came out, it changed that to <br />.

The reason for this is that almost all HTML tags are containers - there is a start tag and an end tag.  When you use them, all content in between the start and end tags is what the tag meaning is applied to.  For example:   This is <b>bold</b> text   would display with the word "bold" in bold font.

A very small number of HTML tags do not have end tags - <br> is an example, with <hr> (for "horizontal rule" - it places a line across the page) is another example.  In order to be more consistent, the rule was made that ALL tags MUST have a start and end.  For cases where tags are not containers, the tag is changed to sort of incorporate the start and end tags all in one by adding the "/" before the end.

Right now, all browsers support the current version as well as most tags in previous versions (they are backwards compatible).  At some point, however, they will stop supporting the old versions - if that ever happens then <br> will not be interpreted by a browser, so it is good to use the currently supported set of tags.

I bet you're sorry you asked!
by Gaile Connolly G2G6 Pilot (817k points)
selected by Martha Mcaulay
Thank you very much, Gaile. Fabulously explained.
Thank you for that explaination, I'll start using <br/> from now on.
Great explanation of self-closing tags Gaile,

As they say... "always finish what you start".
ditto... i've always wondered about that.

Related questions

+2 votes
1 answer
59 views asked Oct 26, 2020 in WikiTree Tech by Anon Deacon G2G1 (1.4k points)
+2 votes
2 answers
127 views asked May 14, 2018 in WikiTree Help by Marj Adams G2G6 Mach 3 (37.5k points)
+5 votes
1 answer
77 views asked Jul 4, 2017 in WikiTree Tech by Eva Ekeblad G2G6 Pilot (392k points)
+4 votes
1 answer
+13 votes
3 answers
133 views asked Aug 31, 2016 in WikiTree Tech by Kitty Linch G2G6 Mach 4 (40.7k points)
+14 votes
2 answers
+12 votes
3 answers
+3 votes
1 answer
116 views asked Apr 28, 2016 in Policy and Style by Victoria Surr G2G6 (7.6k points)
+17 votes
3 answers
340 views asked Apr 20, 2019 in Policy and Style by Erik Oosterwal G2G6 Mach 4 (49.1k points)

WikiTree  ~  About  ~  Help Help  ~  Search Person Search  ~  Surname:

disclaimer - terms - copyright