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?
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?
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.
</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.
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.
In HTML5, for convention, is better to use <br>
, in HTML you can use <br>
and <br />
, </br>
is invalid in HTML and HTML5.
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.
`, I suppose... – Andrea Salicetti Feb 19 '14 at 09:48
- Use away my friend! You'll no doubt get some CSS fanatics saying it's evil and the like, but it's personal preference, really. – laminatefish Feb 19 '14 at 09:49
or
?](http://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br) – Andrea Salicetti Feb 19 '14 at 09:49
` for as it is? – Stefan Fisk Feb 19 '14 at 09:49
`, possible two, just for breaks in text, then it's fine. Just don't go using it to create about 200px of space between two elements! – SaturnsEye Feb 19 '14 at 09:51