在 HTML </head> 之间放置代码或内容是否合适?和<身体&g

Is it proper to place code, or content between the HTML lt;/headgt; and lt;bodygt; tags(在 HTML lt;/headgt; 之间放置代码或内容是否合适?和lt;身体gt;标签)
本文介绍了在 HTML </head> 之间放置代码或内容是否合适?和<身体>标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

是否可以将 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;身体&gt;标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
How do I make a TextGeometry multiline? How do I put it inside a square so it wraps like html text does inside a div?(如何制作 TextGeometry 多线?如何将它放在一个正方形内,以便它像 html 文本一样包裹在 div 内?) - IT屋-程序员软件开发技术分享社
Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)
Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)
Put in bold part of description in metatag Drupal module(将描述的粗体部分放在元标记 Drupal 模块中)
Is it possible to compile Coffeescript code in script tags in html files?(是否可以在 html 文件的脚本标签中编译 Coffeescript 代码?)