• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What's the diff between html code <br> and <br /> ?

I think it has something to do with xml. I was looking a few months ago and XHTML has to conform to XML standards, part of which is that everything needs a closing tag. since a break doesn't have a closing tag, its included by having the space-slash in the tag itself.

w3schools.com should be able to verify/clarify this.
 
Shahbazq has it right. In the XHTML standard, all tags have to be closed, including the ones that are just a single tag like br or img.
 
Originally posted by: igowerf
Shahbazq has it right. In the XHTML standard, all tags have to be closed, including the ones that are just a single tag like br or img.

this is the correct answer. <br> is HTML, <br /> is XHTML. browsers interpret tham as the same thing.
 
New protocols (xml) require every tag to be closed. <br> is really only an opening tag. Any tag <x> can be opened and closed in one go as <x /> if you don't want to enclose any content within the tag. In short, <br /> is the correct way to insert a line break. <br> theoretically won't work after backwards compatibility is removed, though it doesn't look like that will ever really happen, so it probably doesn't matter.
 
Also, it's important to have the space there for browser compatibility. Browsers that don't support <br/> will just ignore the / if it's not adjacent to the main tag.
 
Originally posted by: shahbazq
I think it has something to do with xml. I was looking a few months ago and XHTML has to conform to XML standards, part of which is that everything needs a closing tag. since a break doesn't have a closing tag, its included by having the space-slash in the tag itself.

w3schools.com should be able to verify/clarify this.


That be it...
 
Just cause no one's mentioned it yet: closing every tag has been in the latest html standard for 5 or 6 years now (yes xhtml is html). I don't know why anyone would start using the old version.

Oh, and lol @ jediknight 🙂
 
use <br />

it is the new standard
its only a matter of time when <br> stops working (could take a looong time though)
and I see no reason not to 😛
 
<br> won't stop working (or at least it shouldn't) as long as you have the proper doctype at the top of your page.
 
Originally posted by: Czar
use <br />

it is the new standard
its only a matter of time when <br> stops working (could take a looong time though)
and I see no reason not to 😛

I think <br /> is only for XHTML though. You shouldn't use it if your DOCTYPE is for HTML. It'll still work though.
 
Originally posted by: igowerf
Originally posted by: Czar
use <br />

it is the new standard
its only a matter of time when <br> stops working (could take a looong time though)
and I see no reason not to 😛

I think <br /> is only for XHTML though. You shouldn't use it if your DOCTYPE is for HTML. It'll still work though.

true, but xhtml is the new standard
 
Originally posted by: Czar
Originally posted by: igowerf
Originally posted by: Czar
use <br />

it is the new standard
its only a matter of time when <br> stops working (could take a looong time though)
and I see no reason not to 😛

I think <br /> is only for XHTML though. You shouldn't use it if your DOCTYPE is for HTML. It'll still work though.

true, but xhtml is the new standard

Newness isn't a virtue in and of itself.

http://www.hixie.ch/advocacy/xhtml

In the end, the rabid self-righteous standards-obsessed web movement is mostly a waste of energy. Yes, it is good to write sensible html; yes, CSS is handy; yes, tables can be a nightmare -- but in the end, what does it really matter? The only people that really care are other web nerds who are just as rabid, just for the sake of being rabid. Your site will work just fine in HTML 4 or (god forbid) non-100%-valid HTML.

By the time <br> stops working (hah), we will probably have much bigger problems to worry about. No one controls the web and browser makers are not going to cause millions of sites to display incorrectly just for the hell of it.

</rant> 😛

edit: haha, this guy is great:
My third reason to refuse the validation circus is the most personal and least technical one. It's an emotional matter. My rationality has taken a holiday.

To me, the standards and (especially) the way we should implement them have taken on the insufferable air of a dogmatic, uncreative religion that only exists to enforce its arbitrary rules about what to do and how to think, ministered by a self-proclaimed caste of bigot priests.

I feel like starting a movement or something.
 
Back
Top