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

tag difference

Pls, I need to understand the difference between the <br> and <br /> tags. I don't understand why both of then work for line breaks and horizontal line at same time in different occasions. Pls, what am I getting wrong?

3rd May 2022, 12:29 AM
JoE
JoE - avatar
2 Answers
+ 9
<br /> is self-closing following XML syntax. Modern browsers read <br> and process it as <br /> in the backstage. Therefore the / becomes optional now. Quick glimpse at XML: https://developer.mozilla.org/en-US/docs/Web/XML/XML_introduction
3rd May 2022, 12:45 AM
Gordon
Gordon - avatar
+ 1
Thank you @Gordon.
3rd May 2022, 8:39 PM
JoE
JoE - avatar