breaking tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

breaking tag

what is the difference between <br/> and <br> tags ?

25th Oct 2017, 8:59 PM
Hmmam Babe khuoja
Hmmam Babe khuoja - avatar
2 Answers
+ 6
<tag/> was the required shorthand way to write self-closing and empty tag in XHTML (Html version based on XML specifications) standard, and was supported in oldest Html versions to be more easily compatible with XML requirements, but is no more a valid notation in latest Html5, even if browsers auto-correct this kind of "malformed" syntax... <br/> should work, but it's advised today to use <br> instead, as well as <img src="" alt=""> rather than <img src="" alt=""/> (that's right obviously for all no-content tags -- <hr>, <input> and so on)
26th Oct 2017, 2:37 AM
visph
visph - avatar
+ 5
In XHTML, there must be a slash. In HTML, it doesn't matter.
25th Oct 2017, 11:29 PM
LunarCoffee
LunarCoffee - avatar