HTML document

An HTML document is a text file that you write to be interpreted and displayed by the browser.



What is HTML document

An HTML document is a text file that is written to be interpreted and displayed by the browser. Of course, creating this document should be based on HTML rules.

The following code shows the overall structure of an HTML document.

<!DOCTYPE html>
<html>
  <head>
    <title>Page Title</title>
  </head>
  <body>
      [Document contents...]
   </body>
</html>

We start the HTML document by specifying its version. So by placing the following statement at the start of the document, we tell the browser that we use html5 rules to write our HTML document.

<!DOCTYPE html>

Please note that <!DOCTYPE> is not an HTML tag. This is a definition that tells the browser what version of HTML our document is written in. (Read more about HTML versions)

All elements of the HTML document must be in the element <html>.
Element <html> is the root element of our document. This element is unique, meaning that this element is used only once in this document.
Inside the element <html> There are two other unique elements that are in succession. Element <head> and element <body>
Everything that appears on the browser page is inside the <body> element.
And inside the <head> element, there are metadata that are the elements that complement our document.

<< : What is HTML Web Browser : >>