Line Break | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Line Break

The lessons demonstrate to enter a <br/> for a line break. I noticed that I accidentally forgot to add the / at the end of <br>. This didn't seem to effect the HTML? Is this true throughout all HTML?

28th Mar 2018, 12:39 PM
Gary Butler
Gary Butler - avatar
3 Answers
+ 6
In HTML (up to HTML 4): use <br> In HTML 5: <br> is preferred, but <br/> and <br /> is also acceptable. In XHTML: <br /> is preferred. Can also use <br/> or <br></br>. In HTML, the <br> tag has no end tag. In XHTML, the <br> tag must be properly closed, like this: <br />. FOR MORE: https://stackoverflow.com/questions/1946426/html-5-is-it-br-br-or-br
28th Mar 2018, 12:46 PM
Baraa AB
Baraa AB - avatar
+ 6
<br> → HTML <br /> → XHTML
28th Mar 2018, 1:07 PM
mar
+ 2
this is called the self ending tag...... You can see the same syntax of img tag also....... "/" after br and img is optional at all...... <br> will give same output as <br />
28th Mar 2018, 12:46 PM
Raj Chhatrala
Raj Chhatrala - avatar