Open In App

How to define the root of an HTML document ?

Last Updated : 23 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

The <html> tag in HTML is used to define the root of HTML and XHTML documents. The <html> tag tells the browser that it is an HTML document. It is the second outer container for everything that appears in an HTML document followed by the <!DOCTYPE> tag. The <html> tag requires a starting and end tag.

Syntax:

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

Attribute Value: The <html> tag contains single attribute xmlns whose attribute value is http://www.w3.org/1999/xhtml. It is used to define namespace attributes.

Example 1:

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        How to define the root
        of an HTML document?
    </title>
</head>
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
      
    <p>
        A computer science portal
    </p>
  
</body>
</html>


Output:

Example 2:

HTML




<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<head>
    <title>
        How to define the root
        of an HTML document?
    </title>
</head>
<body style="text-align: center;">
    <h1 style="color: green;">
        GeeksforGeeks
    </h1>
      
    <p>
        A computer science portal
    </p>
</body>
  
</html>


Output:

Supported Browsers:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads