HTML: The HTML Tag

0
344
HTML tag

The <html> tag is used to represent the root of a HTML document. It is highly recommended that you put this at the start and end of your document.

If you are familiar with the Document Object Model (DOM), you know that this is a data structure consisting of nodes representing elements in a tree like hierarchy. The root of the document corresponds to the top of the tree with the <html> element. A great way to see the DOM tree is by using Google Chrome and its Developer Tool to view a web page.

Here we see that the <html> tag is at the root of the document:
Google Chrome DOM inspector

Example Usage:

  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <title>Sample HTML 5 document</title>
  5.   </head>
  6.   <body>
  7.     <main>
  8.       <p>Hello, Internet World!</p>
  9.     </main>
  10.   </body>
  11. </html>