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

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

1 Answer

+15 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 G2G Astronaut (1.2m points)
selected by Living Edgerton
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.
<br> is still the recommendation of the latest HTML specification, and always has been.   <br /> was introduced by the XHTML specification, which is an alternative to HTML, it is NOT a replacement, and HTML is not deprecated or going away; browsers will not stop supporting HTML any time in the foreseeable future.

According to current data from W3Techs, only about 5.8% of web pages follow XHTML .

Related questions

+7 votes
0 answers
192 views asked Mar 18, 2023 in WikiTree Help by Nancy Caton G2G2 (2.4k points)
+3 votes
1 answer
165 views asked Oct 26, 2020 in WikiTree Tech by Babs Deacon G2G2 (2.7k points)
+4 votes
2 answers
216 views asked May 14, 2018 in WikiTree Help by Marj Adams G2G6 Mach 4 (44.4k points)
+6 votes
1 answer
165 views asked Jul 4, 2017 in WikiTree Tech by Eva Ekeblad G2G6 Pilot (573k points)
+5 votes
1 answer
+14 votes
3 answers
274 views asked Aug 31, 2016 in WikiTree Tech by Kitty Linch G2G6 Mach 4 (43.5k points)
+15 votes
2 answers

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

disclaimer - terms - copyright

...