嵌套 <html> 是否有效?<html> 里面? [英] Is it valid to nest <html> inside <html>?
本文介绍了嵌套 <html> 是否有效?<html> 里面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是有效的 HTML 吗?
<头/><身体><p>你好,世界</p><头/><身体><p>你好,世界 2:指针的复仇</p></html><头/><身体><p>Hello, World 3: GOTO null</p></html></html>
根据
Is this valid HTML?
<!DOCTYPE html>
<html>
<head/>
<body>
<p>Hello, World</p>
<html>
<head/>
<body>
<p>Hello, World 2: Revenge of the Pointer</p>
</body>
</html>
<html>
<head/>
<body>
<p>Hello, World 3: GOTO null</p>
</body>
</html>
</body>
</html>
According to the HTML5 specs, the <html>
element can be used:
- As the root element of a document.
- Wherever a subdocument fragment is allowed in a compound document.
It's the second part that I'm confused about. Does this mean that <html>
is a "document" and any nested <html>
is a "subdocument fragment"? How can I tell if this is "allowed"?
解决方案
As said by Guffa
A compound document is a document in itself and you can't use html to make a sub-document.
But a html may contain a iframe which is a sub-document and has html tag.
这篇关于嵌套 <html> 是否有效?<html> 里面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文