The anatomy of an HTML document

A minimal and complete HTML document consists of a Document Type Declaration (also referred to as "doctype"), head and body tags enclosed in html tags.

<!DOCTYPE html>
<html>
   <head>
      <title>This is a complete HTML document</title>
   </head>
   <body>
      <p>HTML content here</p>
   </body>
</html>

The doctype enables the parsing and validation of HTML documents by browsers. The latest version of HTML which is HTML 5 does not require a Document Type Definition (DTD- a set of markup declarations that define the type of a document). HTML5's doctype is therefore short and simple as defined above.

The <head> tag is used to hold information such as: the HTML page title, links to Cascading Style Sheets (CSS), JavaScript code and links to JavaScript code, and other metadata.

The <body> tag is used to define the actual contents of the document. This content is what is rendered or shown to a user. All non-head specific elements such as paragraphs, tables, images, etc, can be used within the body tag.