HTML
<html>
element
represents the root (top-level element) of an HTML document, so it is also referred to as the
root element
. All other elements must be descendants of this element.
| 内容类别 | None. |
|---|---|
| 准许内容 |
One
<head>
element, followed by one
<body>
元素。
|
| Tag omission |
The start tag may be omitted if the first thing inside the
<html>
element is not a comment.
The end tag may be omitted if the
<html>
element is not immediately followed by a comment.
|
| Permitted parents | None. This is the root element of a document. |
| Implicit ARIA role | 无对应角色 |
| Permitted ARIA roles |
No
role
permitted
|
| DOM 接口 |
HTMLHtmlElement
|
此元素包括 全局属性 .
manifest
version
xmlns
"http://www.w3.org/1999/xhtml"
. This is required in documents parsed with XML
parsers
, and optional in text/html documents.
<!DOCTYPE html> <html lang="en"> <head>...</head> <body>...</body> </html>
Providing a
lang
attribute with a
valid IETF identifying language tag
在
<html>
element will help screen reading technology determine the proper language to announce. The identifying language tag should describe the language used by the majority of the content of the page. Without it, screen readers will typically default to the operating system's set language, which may cause mispronunciations.
Including a valid
lang
declaration on the
<html>
element also ensures that important metadata contained in the page's
<head>
, such as the page's
<title>
, are also announced properly.
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of '<html>' in that specification. |
实时标准 | |
|
HTML5
The definition of '<html>' in that specification. |
推荐 |
添加支持
manifest
attribute (deprecated later).
Obsoleted the
version
属性
|
|
HTML 4.01 Specification
The definition of '<html>' in that specification. |
推荐 |
Deprecated the
version
属性
|
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
html
|
Chrome 完整支持 Yes | Edge 完整支持 12 | Firefox 完整支持 Yes | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 Yes | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
manifest
弃用
|
Chrome 完整支持 4 | Edge 完整支持 12 |
Firefox
完整支持
3.5
|
IE 完整支持 10 | Opera 完整支持 10.6 | Safari 完整支持 4 | WebView Android 完整支持 4 | Chrome Android 完整支持 18 | Firefox Android 完整支持 4 | Opera Android 完整支持 11 | Safari iOS 完整支持 3.2 | Samsung Internet Android 完整支持 1.0 |
version
弃用
|
Chrome 完整支持 Yes | Edge 完整支持 12 | Firefox 完整支持 Yes | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 Yes | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
xmlns
|
Chrome 完整支持 Yes | Edge 完整支持 12 | Firefox 完整支持 Yes | IE 完整支持 Yes | Opera 完整支持 Yes | Safari 完整支持 Yes | WebView Android 完整支持 Yes | Chrome Android 完整支持 Yes | Firefox Android 完整支持 Yes | Opera Android 完整支持 Yes | Safari iOS 完整支持 Yes | Samsung Internet Android 完整支持 Yes |
完整支持
弃用。不要用于新网站。
见实现注意事项。
<html>