为什么我们使用< html>标记,虽然我的网站运行完美,没有< html>标签 [英] why we use <html> tag although my website runs perfect without <html> tag
问题描述
我需要知道从网页开头使用< html>
标签有什么用,尽管没有这些< code>< HTML> < / html>
标签。
< html>
标记。 < html>
标记不是必需的。 来自DTD:
<!ELEMENT HTML OO %html.content;) - 文档根元素 - >
两个 O
s表示开始和结束标签(分别)是可选的。
另一方面,元素是必需的(但语言的设计使浏览器可以暗示它)。
由于一个DOM由一个节点树组成,所以你必须有一个节点(根元素)用于其他任何事物的挂起,那就是html元素。
它也是一个非常有用的地方,它可以粘贴适用于整个文档的 lang
属性。
I need to know what is the use of <html>
tag from the beginning of the webpage although website runs perfectly without these <html>
</html>
tags.
I knew that doctype is required but why this <html>
tag is required.
The <html>
tag is not required.
From the DTD:
<!ELEMENT HTML O O (%html.content;) -- document root element -->
The two O
s indicate that the start and end tags (respectively) are optional.
The element, on the other hand, is required (but the language is designed so that browsers can imply it).
Since a DOM consists of a tree of nodes, you have to have one node (the root element) for everything else to hang from, and that is the html element.
It is also a really useful place to stick a lang
attribute that will apply to the entire document.
这篇关于为什么我们使用< html>标记,虽然我的网站运行完美,没有< html>标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!