是否可以将 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 </head> 之间放置代码或内容是否合适?和<身体>标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 Jasmine 中编写 FileReader 测试?How do I write FileReader test in Jasmine?(如何在 Jasmine 中编写 FileReader 测试?)
JS/HTML5 WebSocket:无需 HTTP 调用即可连接JS/HTML5 WebSocket: Connect without HTTP call(JS/HTML5 WebSocket:无需 HTTP 调用即可连接)
在 XHR 中使用 multipart/form-data 作为 Content-Type 时收Getting #39;400 Bad Request#39; when using multipart/form-data as Content-Type in XHR(在 XHR 中使用 multipart/form-data 作为 Content-Type 时收到
CSS:分页后重复表头(打印视图)CSS: Repeat Table Header after Page Break (Print View)(CSS:分页后重复表头(打印视图))
为什么将 JavaScript 放在页面的页脚中?Why put JavaScript in the footer of a page?(为什么将 JavaScript 放在页面的页脚中?)
从 JSON 响应访问 [Symbol(Response internals)]Accessing [Symbol(Response internals)] from JSON response(从 JSON 响应访问 [Symbol(Response internals)])