Empty tags | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Empty tags

Is it <br> , <br /> or <br/> ? I don't get which one works

9th Oct 2022, 7:59 PM
Brownie❤️
Brownie❤️ - avatar
7 Answers
+ 3
Most browser won't have problem if you type <br> in html, but if you work with some framework/library(where you type html inside javascript), compiler may have problem converting code, I always use <br /> because of it. There are no diference between <br /> and <br/>, this space means nothing to computer, but I like space it make code cleaner. Same is for any other self closening tag, like <hr /> <img />, so all of them are valid, and you can choose one you like the most. But my suggestion is to close tag with /> at end, because sometimes you may need to close it, and it will be hard to do if you have 1000 tags to manually close. More about this topic: https://www.tutorialstonight.com/self-closing-tags-in-html
9th Oct 2022, 11:07 PM
PanicS
PanicS - avatar
+ 3
Use which ever you want, they are all the same <br> can be used with or without closing it with / it's a single tag with no closing tag like other html tags
11th Oct 2022, 12:56 PM
Madrine Nansiimbi
Madrine Nansiimbi - avatar
+ 2
<br\> is the most use and it make your code clean
11th Oct 2022, 2:52 PM
Mahamat saleh Ousman
0
Jay Matthews thanks
10th Oct 2022, 7:54 AM
Brownie❤️
Brownie❤️ - avatar
0
PanicS thanks
10th Oct 2022, 7:56 AM
Brownie❤️
Brownie❤️ - avatar
0
<br> tag is the line break tag
11th Oct 2022, 3:12 AM
Bhyri Sai Shilpa
0
<br> tag
11th Oct 2022, 6:08 AM
Sujit Maurya
Sujit Maurya - avatar