Is it proper to place code, or content between the HTML </head> and <body> tags

情到浓时终转凉″ 提交于 2019-11-28 11:04:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!