Introducing elements
Just like the structure of a parcel of land, the structure of an HTML document (which the browser uses to create a web page) can also be represented pictorially as a treeA way of representing the structure of information.. As before, the nodesA part of a tree. represent pieces, some of which are further broken into pieces. The language HTML specifies what kinds of pieces there can be. Each piece is called an element.

Part of a tree representation of an HTML document
The element for the entire document is the html element. It can be broken into two pieces, that is, two elements, the head element and the body element. The roles of head element and the body element are easy to describe: the head element gives information about the document and the body element gives the information displayed on the page. These three elements exist for every web page.
The beginning and end of an element are marked in a special way. Each type of element has an associated tag name, which is often (but not always) the name of the element. The tag names of the html element, head element, and body element are html
, head
, and body
, respectively. Using a tag name, tags can be formed: a start tag (like <head>
) is formed by putting the tag name between <
and >
and an end tag, or closing tag (like </head>
), is formed by adding a /
before the tag name and then putting it between <
and >
. There are certain elements for which including end tags is optional. For clarity and simplicity, we will include end tags.
To create a body element, we use the start tag <body>
followed by whatever we wish to put in the body followed by the end tag </body>
. An element is everything from the start tag through the end tag, with the term content used to refer to everything in between. In the example below, the content of the html element includes a head element and a body element. Notice the use of indenting by two spaces to show what is contained in what.
<html>
<head>
</head>
<body>
</body>
</html>