+ 3
I have a doubt.....
i have read- The head of an HTML file contains all of the non-visual elements that help make the page work. but when i write like this- <html> <head> "hi" </head> </html> this code display "hi" as output which is inside the head. another thing- when i write code like- <html> <head> </head> </html> "hi" this also prints "hi" in the output which is outside the tag. so can anyone explain me what is going on above?
1 Answer
+ 6
Because this is rendered in WEB BROWSER in the following way
<html>
<head>
</head>
<body>
"hi"
</body>
</html>
Web browsers are smart enough to understand the visible code and place it at correct position inside body tag while rendering.
However, any standard HTML editor in strict mode will throw error.