Forward slash | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Forward slash

Why does the app have a lot of tags with the closing forward clash in the back? Example <br/> ?? I’ve always seen it written like </br>

20th Mar 2020, 2:50 AM
Ja’Quan Thompson
Ja’Quan Thompson - avatar
1 Answer
+ 4
br tag isn html ia an empty element that does not need to be closed, i.e it does not require an end tag, that is why they usually have the slash at their end <br/> but the slash is optional; you can put it or not, their is no effect. Elements like hr, input, br, !doctype amongst other are empty elements that dont require end tags. But other elements require end tags and without closing them, well you may have your document having lots of errors, especially with some js code embedded to it, they must be closed, eg <p>...</p> amongst others. Happy coding 😊 Keep coding 🙏
20th Mar 2020, 5:04 AM
Alfred Juma
Alfred Juma - avatar