<br /> vs. </br> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

<br /> vs. </br>

What is the difference of this two? i've seen that in the lesson they use <br /> for single line break? But i saw </br> in the comments what is it for?

11th May 2017, 3:16 AM
¤ rookie ¤
¤ rookie ¤ - avatar
4 Answers
+ 8
The shorthand syntax explained by @Volker Milbrandt is not valid in Html5 ( even uf browsers try to correct it )... it is a XML shorthand rule ^^ As it's only in XML that you use the <xxx/> form for not container tags: in Html5 this form IS NOT valid. So, <br> or <hr> and so on such tags is the only valid syntax. A lot of coders keep the habit to use the <xxx/> form, because it was valid in previous version of Html ( and mandatory in XHtml branch ), but they have to lose it ;P
11th May 2017, 5:23 AM
visph
visph - avatar
+ 2
</br> is wrong syntax.
11th May 2017, 3:27 AM
Calviղ
Calviղ - avatar
+ 1
I think <br /> is for HTML5 and </br> is for old html version.
11th May 2017, 3:57 AM
Yash Chaudhari
Yash Chaudhari - avatar
0
</xxx> is always the closing tag of <xxx>. The form <xxx /> is only an abreviation you can use if there is nothing you want to include between these enclosing tags. For example <p /> is an empty paragraph whereas <p>some text</p> has „some text“ included. Thus you might write <br /> or <br></br>.
11th May 2017, 5:06 AM
Volker Milbrandt
Volker Milbrandt - avatar