Reputation:
Is </br>
still an accepted HTML5 tag?
I got the impression that is not so used anymore and there should be something more modern that replaced it.
What should I use instead to be HTML compliant?
Upvotes: 4
Views: 17048
Reputation: 5604
Simply <br>
is sufficient.
The other forms are there for compatibility with XHTML; to make it possible to write the same code as XHTML, and have it also work as HTML. Some systems that generate HTML may be based on XML generators, and thus not have the ability to output just a bare <br>
tag; if you're using such a system, it's fine to use <br/>
, it's just not necessary if you don't need to do it.
Very few people actually use XHTML, however. You need to serve your content as application/xhtml+xml
for it to be interpreted as XHTML, and that will not work in IE (it will also mean that any small error you make will prevent your page from being displayed, in browsers that do support XHTML). So, most of what looks like XHTML on the web is actually being served, and interpreted, as HTML. See Serving XHTML as text/html Considered Harmful for some more information.
Upvotes: 2
Reputation: 5625
There is no info on <br>
tag being invalid in HTML5 spec (I read w3.org and mozilla developers). The only deprecation notice i found is the clear
attribute, but it doesn't really matter, as it was rarely used anyways.
The only thing about the usage of <br>
tag - you should only use it for typography reasons - to provide line breaks inside a text. You absolutely should not use <br>
for layout reasons - use display: block
elements instead. Also you shouldn't use multiple <br>
tags, and go for margin
or padding
css properties.
Other than that it's still perfectly valid element. It's used not too often because <p>
is better suited for text style, but sometimes line break without margin is ok too.
Upvotes: 1
Reputation: 4275
please refer the link
HTML 5: Is it <br>, <br/>, or <br />?
it has better description on it.
Upvotes: 0
Reputation: 525
In HTML5, for convention, is better to use <br>
, in HTML you can use <br>
and <br />
, </br>
is invalid in HTML and HTML5.
Upvotes: 0
Reputation: 53
This link http://www.w3schools.com/tags/tag_br.asp
Mentions that there is no difference b/w HTML 4 and HTML 5 regarding the BR tags.
Upvotes: 0
Reputation: 1729
</br>
is invalid. It should either be <br />
or <br>
. For HTML5 it is the best to just use <br>
but I'm pretty sure it doesnt matter when looking at the validator.
Upvotes: 1