Hey, What's the difference with <br> and <br /> | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Hey, What's the difference with <br> and <br />

seams they both have same outcome

3rd Jan 2017, 3:35 AM
John Smith
John Smith - avatar
6 Answers
+ 4
<br /> is the proper way of doing it. All HTML tags should be closed. So either the self closing <br /> or the less used <br></br> should be used. Browsers will often understand what it should render as without closing (just using <br>), but its bad code.
3rd Jan 2017, 3:37 AM
Lauren
+ 3
<br> is the normal tag in all versions of Html, except in Xhtml branch, based on XML and requiring the final slash ( / ) in the tag, when shorthanding the complete paired form of empty content ( <tag></tag> is shortened <tag /> in Xml and Xhtml ). By extention, html syntaxic rules defined that tags not allowing content can avoid closing tag without adding the slash ( / ) at the end of the opening one as in Xml. With Html5 and the abandon of the Xhtml branch, the <br /> form is deprecated, even if browsers still support them ( graceful of permissivity of Html/SGML based against the not one of Xhtml/Xml -- Xml is itself based on Sgml ^^ ). </br> tag, with the slash ( / ) at begin, is not valid by itself, even for same reasons than previously it was relatively supported ( means silently corrected ), and writing <br></br> isn't much valid in Html specifications ( so, always for the preceding auto-correction, this would be result to <br><br> in the display :P )
7th Feb 2017, 11:46 PM
visph
visph - avatar
+ 1
<br> is the tag some tags like it doesn't have closing tag </br> but some browser still search for it so <br/>is used
3rd Jan 2017, 7:06 AM
Sandeep Chatterjee
0
@John Smith ●Just to add my two cents about what I have come to know, the difference between <br/> & </br> is quite simple. ●The tag <br/> was (and in some places still is) used in XHTML as it was the required syntax or language if you will of that tag The coding language XHTML is a branch off from the language XML that had a syntax rule that required all tags to be closed. In particular though, the <br /> tag is only really used for the sake of compatability with older browsers. ● However, when HTML5 came along the <br /> became obsolete from being a requirement from the syntax of br tags, thus you only need to write </br> in HTML5. ●It is important to note & reiterate again however that when dealing with older browsers, you must used <br /> and NOT </br> otherwise it won't be compatible. So other than for the sake of an older browser you don't need to use it. ● Lastly just to throw this in here, XHTML (Extensible Hypertext Markup Language) is similar but different from HTML (Hypertext Markup Language).
4th Jan 2017, 5:42 AM
BrightAsTheStars
0
but </br> stands for linebreak
18th Jan 2017, 1:06 AM
chris negati
chris negati - avatar
0
<br> = ? <br/> = linebreak
7th Feb 2017, 9:10 PM
Gilbert Akwaboah
Gilbert Akwaboah - avatar