Permitted children: one <head>, then one <body>. Implicit ARIA role is document. Tags may be omitted by the parser in edge cases — still write them explicitly.
Reference
Attributes
The attributes you will meet on <html> (plus all global attributes):
Define CSS variables on the root so children can reuse them.
:root is the same element as html in HTML documents (slightly higher specificity as a pseudo-class).
Keep structure in HTML; keep look-and-feel in CSS.
Edge Cases & Pitfalls
Most root-element bugs are missing lang, a missing doctype, or confusing html with head.
a11y
Always set lang
Without lang on <html>, screen readers often use the OS language and may mispronounce the page (including the title).
doctype
DOCTYPE comes first
Put <!DOCTYPE html> before <html>. Skipping it can trigger quirks mode.
names
html ≠ head
<html> is the document root. <head> holds metadata inside that root.
obsolete
Skip version and manifest
version is obsolete. manifest (AppCache) is obsolete — use service workers for offline apps.
one root
Only one html element
Never nest another <html>. Nested documents belong in <iframe> (their own document).
Compatibility
Browser Support
The <html> element is the core HTML document root in every browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
<html>
Widely available since about July 2015 (and long before). Every browser expects a single html root wrapping head and body.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet ExplorerAll
Supported
htmlWidely supported
Bottom line: Safe everywhere. Always write DOCTYPE + html with lang, then head and body.
Remember
Key Takeaways
Root: one <html> wraps the whole document.
Children:head then body — nothing else at that level.
lang: always set it on the root for accessibility.
Obsolete: skip version and manifest.
One line:<!DOCTYPE html> then <html lang="…"> wrapping head and body.
UA style
Default CSS Settings
Typical user-agent defaults (exact values vary by browser):
default.css
html {
display: block;
}
/* html also establishes the initial containing block
and is the :root element in HTML documents */
Authors often set font-size, color schemes, or CSS variables on html / :root.
Frequently Asked Questions
The html element is the root of every HTML document. All other elements must be descendants of it, and a document may have only one html element.
Yes. Put <!DOCTYPE html> first so browsers use standards mode. The doctype is not an HTML element; it sits before the html root.
Exactly one head element followed by one body element (in that order).
lang tells browsers and screen readers the primary language of the page. Without it, assistive tech often falls back to the OS language and may mispronounce content.
The HTML standard allows omission in some cases, but always write both tags so you can set lang and keep the document clear.
No. version is obsolete and redundant with the doctype. manifest (application cache) is obsolete — use service workers instead.