+ 2

In the try it yourself section the program doesn't have any <html> ,<head>,<body> starting and ending tags but it still works.

Any relevant explanation for this??

17th Jul 2017, 10:27 AM
Nikhil
Nikhil - avatar
5 odpowiedzi
+ 6
Html specification tell browser to display any html content as well they can, even if invalid... This cause browser to correct code not providing the theorically mandatory basic structure, and add such content to an implicit valid html structure, inside the body part (root element of displayed content ^^)... even in browsers, not only in code playground ;)
17th Jul 2017, 11:04 AM
visph
visph - avatar
+ 5
@4rontender: browsers are mandatory by html specifications to be clever and try clean invalid code...
17th Jul 2017, 11:28 AM
visph
visph - avatar
+ 2
Those tags are used for the main page, the code section is just a part of that main page.
17th Jul 2017, 10:37 AM
Bàng Tứ Cường
Bàng Tứ Cường - avatar
+ 2
Browser is clever and try clean your code☺
17th Jul 2017, 11:06 AM
Вап
+ 2
thank you everyone 😃😃👍
17th Jul 2017, 11:46 AM
Nikhil
Nikhil - avatar