[Solved] Why Can’t You Put content in the element?


The structure your friend proposes violates the global structure of an HTML document; the <body> tag must contain the document’s actual content, whereas the <head> tag must only contain information describing the document.

The incorrect markup will in fact render correctly on the page, because most browsers are actually intelligent enough to know that the markup is incorrect, and correct it themselves. If you inspect the DOM, you’ll find that it has automatically been updated to correctly shift the <div> element (and its content) to within the <body> element (just before <nav>):

Fixed

solved Why Can’t You Put content in the element?