Document Structure
HTML <html> element
Root element of an HTML document. Contains the head followed by the body. Declare the document language using lang and add dir when the base direction differs from the default. In HTML syntax certain tags may be omitted under precise rules, but explicit structure is clearer for learners. A doctype precedes the root and is not an element. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<html lang="en">…</html>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| lang | BCP 47 language tag | Declares the language of an element's content and relevant text attributes. It helps pronunciation, translation and language-sensitive CSS; it does not set writing direction. |
Return Value
HTMLHtmlElement
Content model: A head followed by a body.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>Reading notes</title> </head> <body> <h1>Reading notes</h1> <p>Chapter one is finished.</p> </body></html>