问题
Is it okay to place HTML code between the ending of the head area and before the beginning of the body area. I have done this before, on various sites without any problems, however, I would like to know whether this has any backwards compatibility issues, and also whether this is common, or good practice. For example:
</head>
<div id="header">
<h1>Heading</h1>
Code & Content...
</div><!-- #header -->
<body>
Code & Content...
</body>
回答1:
No, is not okay. All the content of the page should go inside <body>
. Check the HTML specification.
Browsers are really forgiving, but even if it works you shouldn't do it.
来源:https://stackoverflow.com/questions/17911272/is-it-proper-to-place-code-or-content-between-the-html-head-and-body-tags