The <html> Element

In this section of our HTML tutorial, we will explore the <html> element, a fundamental component of every HTML document. We will examine its role, attributes, and provide code examples to help you understand how it functions.

Understanding the <html> Element

The <html> element serves as the root element of every HTML document. It encapsulates the entire content of a web page. All other HTML elements, such as headings, paragraphs, links, and images, are contained within the <html> element.

Basic Syntax

Here is the basic syntax of the <html> element:

  • <!DOCTYPE html>: This declaration specifies the HTML version (HTML5) that the document adheres to.
  • <html>: The opening tag of the <html> element.
  • </html>: The closing tag of the <html> element, which marks the end of the document.


The <html> element can also include attributes. The most commonly used attribute is the lang attribute, which specifies the language of the document. This can be helpful for screen readers and search engines. Here’s an example:

In the example above, lang="en" indicates that the document is in English.

Code Examples

Let’s look at a simple HTML document that uses the <html> element:

In this example, the <html> element encapsulates the entire HTML document, with the content contained within the <body> element.


The <html> element is the foundational element of an HTML document, encapsulating the entire content of a web page. Understanding its role and proper usage is essential for creating well-structured web pages. As you continue with this tutorial, you’ll explore more HTML elements, attributes, and techniques to build rich and interactive web pages.