HTML Tutorial: Complete HTML Tutorial
About Lesson

HTML <html> Tag


Concept

The <html> tag is the root element that wraps around all the content on your webpage. Think of it as the trunk of a tree from which all other elements branch out. It’s the starting and ending point of an HTML document, serving as a container for both the <head> and <body> elements.

Implementation

Sponsored by Google

Example 1: Basic HTML Structure

<!DOCTYPE html>
<html>
  <head>
    <title>My Web Page</title>
  </head>
  <body>
    <h1>Welcome to My Web Page</h1>
    <p>This is a paragraph.</p>
  </body>
</html>

Example 2: HTML with Language Attribute

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>My English Web Page</title>
  </head>
  <body>
    <h1>Welcome to My English Web Page</h1>
    <p>This is a paragraph in English.</p>
  </body>
</html>

Try it out below:

powered by Advanced iFrame. Get the Pro version on CodeCanyon.

Attributes Table


Global Attributes

The <html> tag supports all global attributes in HTML.

Specific Attributes


Attribute Value Description
lang string Specifies the language of the document.
xmlns URL Specifies the XML namespace for the document (used in XHTML documents).

Browser Support Table


Browser Support
Chrome Yes
Firefox Yes
Safari Yes
Opera Yes
IE Yes

Default CSS Settings

There are no default CSS settings for the <html> element, as it serves as a container for the entire document.

Conclusion

The <html> tag is the cornerstone of any HTML document. It’s the foundational element that holds everything together, from metadata to content.


Understanding its role and attributes is crucial for anyone delving into web development. It’s like the cover of a book, enclosing all the stories and information within.