+ 2

Is it necessary to close the html tags like <html> or <body>

while coding i realised that we don't necessarily need to close the body and html tags or any other paired tags unless we are adding more after it. and obviously nothing much goes after html tag that affects the view of webpage

8th May 2017, 5:24 AM
Saugat Singh
Saugat Singh - avatar
3 Answers
+ 7
Html permissivity cause browsers to try to correct invalid code... That's why a bad formed html code page is displayed... as much as the browser can interpret the bad code. Some cases are evident ( implicitly, </html> is necessarly the last closing tag, and almost so for </body>: the fix is evident, so most browsers should goo correct them ) but main other cases aren't explicit, neither than implicit... So you need lucky to get the expected result, and you cannot be sure of the result crossover browsers ^^
8th May 2017, 12:08 PM
visph
visph - avatar
+ 6
Smart browsers understand and can parse even an improperly written HTML code. That should not make you write the bad code on purpose, though. Search engines index websites based to wide extent on its HTML syntax. You might not get a high score if your website does not meet the standards. So yes, all closable tags should be closed.
8th May 2017, 6:28 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 3
Don't be fooled by Sololearn's code playground, they fill in the blanks automatically. You should always use those tags.
8th May 2017, 5:27 AM
Ghauth Christians
Ghauth Christians - avatar