<html>: The HTML Element
Last updated: 2026-10-13
<html>The HTML Element
The root element of an HTML document; all other elements live inside it. Use lang to declare the page language.
| Category | Document Structure |
|---|---|
| Content Model | Root element (no parent) |
| Allowed Parents | Any element that accepts flow content |
| Content Tag | Yes — requires closing </html> tag |
| Status | Standard |
📝 Syntax
<html lang="en">
<head>...</head>
<body>...</body>
</html>
⚙️ Attributes
This element supports the global attributes plus the following:
| Attribute | Value | Description |
|---|---|---|
lang | Primary language of the document, helps SEO and accessibility. |
▶ Example
Edit the code below and see the live result in the playground:
🌐 Browser Support
| Browser | |||||
|---|---|---|---|---|---|
| <html> | ✓ v1 | ✓ v12 | ✓ v1 | ✓ v1 | ✓ v1 |
| Supported in all major browsers | |||||
Tip: html is the outermost element; set lang for SEO and screen readers.
❓ FAQ
QWhy is the lang attribute on html important?
A
<html lang='zh'> declares the page's primary language: screen readers pick the right voice, search engines refine language detection, and browsers decide whether to offer translation. A missing lang is a top accessibility-audit finding.QWhich practical attributes can go on the html element?
ABesides
lang: dir (ltr/rtl text direction — required for Arabic and other RTL languages), class (global theme classes), and data-* custom attributes. CSS variables are also commonly defined on :root (html) for site-wide use.QCan a page omit the html tag?
AThe parser auto-completes it, but omitting is discouraged: readability suffers, some toolchains mis-parse, and team consistency breaks. Explicitly writing all three skeleton tags is the baseline for every spec.
🏷️ Related Tags
💡 Related Cases
More case studies coming soon — check back later.