Right sintax

Guys I found that writing <hr> and

it's the same, and even without the / it's work properly, can someone tell me if it's right or wrong doing this? Because even when I write without / work also, plz I need some explanation.

31st Aug 2017, 2:41 PM
Daniel Lucas Aguas
Daniel Lucas Aguas - avatar
3 Answers
+ 4
The right sYntax is without the ending slash (/): this is the only valid way in Html5... Previously to Html5, it was valid syntax to be compatible with XHtml and Xml document/syntax. However, XHtml was abandonned with outcome of Html5, and last specifications no more allows the ending slash for empty/self-closed tags. Anyway, one main characteristic of Html is its permissivity: browsers are intended to display as well as they can even invalid document, so little mistake are easily corrected (ie: correcting <hr/>,
, to
, rarely aren't enough explicit), but you cannot be sure of how each browser will react (and all the more if context is less explicit, as a bad
inside a

, wich is not valid, and more complex to determine how to correct it), and search engine robots will not be as much comprehensible with your invalid code than nicely browsers ;P
31st Aug 2017, 6:52 PM
visph - avatar
+ 1
Can you give an example of your code?
31st Aug 2017, 2:52 PM
Bobby Lindsey
For example this <html> first page


http://www.sololearn.com/images/tree.jpg" alt="">
31st Aug 2017, 2:56 PM
Daniel Lucas Aguas
Daniel Lucas Aguas - avatar