The Structure of an HTML Document

A very simple HTML document might look something like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
  <title>Page Title</title>
</head>

<body>
  <h1>This is a Heading</h1>
  <p>And this is a paragraph.</p>
</body>

</html>

The main parts of this simple HTML document are:

  • A declaration of the document type (specified by the <!DOCTYPE> tag), which specifies the version of HTML (or XHTML) being used.
  • An opening <html> tag which immediately follows the document type declaration, and a closing </html> tag which is the last line of the document.
  • A header section (delineated by the opening <head> and closing </head> tags), which in this example contains just a document title.
  • A body section (delineated by the opening <body> and closing </body> tags), which in this example contains a heading and a paragraph.

<-- Previous Page

Intro to HTML

Next Page -->

Elements, Tags and Attributes