<脚本><html>之前的标签位置标签 [英] <script> tag position before <html> tag
本文介绍了<脚本><html>之前的标签位置标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
和
之间的
标签是否有效?
Can a <script>
tag between <!DOCTYPE html>
and <html>
be valid?
我问的原因是我找到了上面描述的代码.它在任何情况下都有效吗?
The reason I ask is I found the code I've described above. Can it be valid under any circumstances?
推荐答案
没有. 是 HTML 文档的根(或文档)元素;它必须是 HTML 文档中唯一的根级元素(它不能有任何兄弟元素).此外,HTML 只能包含
和
(特别是每一个),这意味着任何其他标签(例如
必须是
或
的后代.
No. <html>
is the root (or document) element of an HTML document; it must be the only root-level element in an HTML document (it cannot have any siblings). Further, HTML can only contain <head>
and <body>
(specifically one of each), meaning that any other tags (e.g. <script>
must be descendants of <head>
or <body>
.
这篇关于<脚本><html>之前的标签位置标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文