The <html>
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.
Content categories | None. |
---|---|
Permitted content | One <head> element, followed by one <body> element. |
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, and it contains a <body> element either that is not empty or whose start tag is present. |
Permitted parents | As the root element of a document, or wherever a subdocument fragment is allowed in a compound document. |
Permitted ARIA roles | None |
DOM interface | HTMLHtmlElement |
This element includes the global attributes.
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 on the 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.
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<html>' in that specification. | Living Standard | |
HTML5 The definition of '<html>' in that specification. | Recommendation | Added support for the manifest attribute (deprecated later).Obsoleted the version attribute |
HTML 4.01 Specification The definition of '<html>' in that specification. | Recommendation | Deprecated the version attribute |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | Yes | Yes | Yes | Yes | Yes | Yes |
manifest
|
4 | Yes | 3.5
|
10 | 10.6 | 4 |
version
|
Yes | Yes | Yes | Yes | Yes | Yes |
xmlns |
Yes | Yes | Yes | Yes | Yes | Yes |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
manifest
|
4 | 18 | Yes | 4 | 11 | 3.2 | Yes |
version
|
Yes | Yes | Yes | Yes | Yes | Yes | Yes |
xmlns |
Yes | Yes | Yes | Yes | Yes | Yes | Yes |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/html