This reference is built into PageRIJ — a live HTML, CSS & SVG authoring and learning environment.

HTML <html> element

The <html> element is the root of an HTML document. Its two child elements are one <head> followed by one <body>. Together they hold the document's metadata and content.

The global lang attribute declares the document’s primary language, such as lang="en" for English. This helps speech synthesis tools choose pronunciation and translation tools interpret the text. Descendant elements inherit that language unless they declare another one.

An ordinary HTML document begins with the <!DOCTYPE html> declaration, which selects standards mode in the browser. The declaration is separate from the root element. Comments and whitespace can also occur around the declaration and root element.

A document has one root <html> element even when its opening or closing tag is omitted under HTML's tag-omission rules. Writing both tags makes the structure explicit and provides a clear place to declare the language.

The example below is a complete document. The root groups its metadata and body content; the visible result comes from the heading inside the body.

Attributes: GLOBALS.

Typical layout:
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Welcome</title>
</head>
<body>
  <h1>Welcome</h1>
</body>
</html>
Visual representation:

Welcome