<html> Tag in HTML

The <html> tag is the root element of an HTML document. It serves as the container for all other HTML elements on the page, except for the <!DOCTYPE> declaration. It is a required tag and must be the first tag in an HTML document.

Key Points on <html> Tag:

Syntax of <html> Tag:

Syntax Example

<html lang="en">
          <head> ... </head>
          <body> ... </body>
        </html>

Example of <html> Tag in HTML:

This example demonstrates the usage of the <html> tag as the root of the HTML document.

Code Example


        <html lang="en">
          <head>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <title>My Web Page</title>
          </head>
          <body>
            <h1>Hello, World!</h1>
          </body>
        </html>
                

Output

Hello, World!

The <html> tag is essential for every HTML document. It must enclose the entire content, including the <head> and <body> tags. It defines the language of the document (using the lang attribute) and helps in specifying metadata and other HTML structures within the document.