在HTML< / head>之间放置代码或内容是否合适?和< body>标签 [英] Is it proper to place code, or content between the HTML </head> and <body> tags

查看:115
本文介绍了在HTML< / head>之间放置代码或内容是否合适?和< body>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在头部区域的结尾和身体区域的开始之间放置HTML代码。我之前做过这些,在各种网站上没有任何问题,但是,我想知道这是否存在任何向后兼容性问题,以及这是普遍的还是好的做法。例如:

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>


推荐答案

不,不好。页面的所有内容都应该在< body> 内。检查 HTML规范
浏览器真的很宽容,但即使它有效,也不应该这样做。

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.

这篇关于在HTML&lt; / head&gt;之间放置代码或内容是否合适?和&lt; body&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆