+ 6

Do you close your <img>, <br> and <hr> tags?

In HTML5 void elements are not required to be closed, that means <br> and <br /> are treated the same. Nevertheless i prefer to use the latest one to make clear I do not expend a closing tag. What version do you prefer to use?

28th Mar 2019, 9:53 PM
Jorge
Jorge - avatar
9 Respostas
+ 9
I depend on users choice but both are same.
30th Mar 2019, 6:55 AM
🇮🇳Harsh Raj 🇮🇳
🇮🇳Harsh Raj 🇮🇳 - avatar
+ 7
Hello, Jorge Depending on the specification: for DOCTYPE HTML, it will be correct <br>, for DOCTYPE XHTML - <br/>. For XHTML it is typical to put a slash before the closing bracket in single tags: <br/>, <hr/>, <input/>, etc. Writing </br> - is incorrect, because BR is a single tag, and a slash after the opening bracket is for closing descriptors only. https://www.sololearn.com/learn/HTML/1028/?ref=app
28th Mar 2019, 11:58 PM
Jella
Jella - avatar
+ 7
I prefer the latter.
29th Mar 2019, 3:32 AM
Sonic
Sonic - avatar
+ 5
I'hv noticed not using of closing tags create unexpected rendering issues on old-browsers like IE and IE based browsers. Also low-end browsers like JAVAME Version of Opera Mini creates problem. Its better to close tags if you are targeting those browsers.
29th Mar 2019, 11:39 AM
Washiul Alam Sohan
Washiul Alam Sohan - avatar
+ 5
True
30th Mar 2019, 4:53 PM
Hector Domingo{ }
Hector Domingo{ } - avatar
+ 5
it is optional I just don't bring it
31st Mar 2019, 2:21 PM
Danyo Joe Crews Kumi Junior
Danyo Joe Crews Kumi Junior - avatar
+ 4
According to the current version of html that is html5 you don't need to add / before the closing bracket. For example <br> will work same as <br/>
29th Mar 2019, 4:43 PM
Prabhat Kumar Singh
Prabhat Kumar Singh - avatar
+ 3
<br> a leg
28th Mar 2019, 11:46 PM
envious eleanor
envious eleanor - avatar