Open In App

HTML <html> Tag

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

The <html> tag defines the root of HTML/XHTML docs, indicating it’s an HTML doc, serving as the main container, following the <!DOCTYPE>. Requires both opening and closing tags.

The <html> tag acts as the main container for all HTML elements (excluding <!DOCTYPE>), framing the entire web content structure.

Syntax

<html> HTML Contents... </html>

Default CSS

The following default values are mostly displayed by the current browsers:

html {
  display: block;
visibility: visible
}

Attribute Value

The <html> tag includes the xmlns attribute. This attribute defines the namespace for attributes, ensuring proper interpretation and compatibility of XHTML elements.

Note: The <html> tag supports the Global Attributes in HTML.

Example 1:  This example illustrates the <html> element in HTML.

HTML




<!DOCTYPE html>
<!-- html tag starts here -->
<html>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>
        <html> Tag
    </h2>
</body>
 
</html>
<!-- html tag ends here -->


Output:

Example 2: In this example, we will be using the xmlns attribute inside the <html> tag. 

HTML




<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
<head>
    <title>html Tag</title>
    <style>
        h1 {
            color: green;
        }
 
        body {
            text-align: center;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h2>
        <html> Tag
    </h2>
</body>
 
</html>


Output:

Supported Browsers

  • Google Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Safari
  • Opera


Last Updated : 20 Dec, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads