HTML <html> Tag
Description
The 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.
CSS Display:
blockSyntax
<!DOCTYPE html>
<html>
<head>...</head>
<body>...</body>
</html>Popular Attributes
| Attribute | Description |
|---|---|
| lang | Specifies the language of the element's content (e.g. "en", "fr"). |
| dir | Specifies the text direction. Values: ltr (left-to-right), rtl (right-to-left), auto. |
This element also supports global HTML attributes such as class, id, style, data-*, and more.
Examples
Basic HTML Document
<!DOCTYPE html>
<html lang="en">
<head>
<title>Title</title>
</head>
<body>
<h1>Hello</h1>
</body>
</html>
A basic skeleton starting from the root html element.
Notes
A valid web document should start with the <!DOCTYPE html> declaration. Technically, it is not an HTML tag, but an instruction to the browser about the language version. The <html> tag follows immediately after it.
It is highly recommended to always include the lang attribute (e.g., <html lang="en">) to declare the document's primary language. This assists screen readers for accessibility and benefits SEO.
Related Tags
Last updated: 8th April 2026