HTML and CSS Reference
In-Depth Information
(X)HTML Document Structure
The DTDs define the allowed syntax for documents written in that version of (X)HTML.
The core structure of these documents is fairly similar. Given the HTML 4.01 DTD, a basic
document template can be derived from the specification, as shown here:
Doctype statement indicates type of document
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equip="Content-Type"
content="text/html; charset=utf-8">
<title>Page Title</title>
Head contains
info about page
</head>
Root HTML
element
encloses
entire doc
<body>
Body
</body>
</html>
Filename: template.html
In this graphical representation, the
<!DOCTYPE>
indicator, which, as previously
mentioned, shows the particular version of HTML being used, in this case 4.01 Transitional.
Within a root
html
element, the basic structure of a document reveals two elements: the
head
and the
body
. The
head
element contains information and tags describing the document, such
as its
title
, while the
body
element houses the document itself, with associated markup
required to specify its structure. HTML5 follows the same core structure but introduces
differences, which is covered in depth in Chapter 2.