HTML and CSS Reference
In-Depth Information
HTML defines three tags that describe the page's overall structure and provide some
simple header information. These three tags—
<html>
,
<head>
, and
<body>
—make up the
basic skeleton of every web page. They also provide simple information about the page
(such as its title or its author) before loading the entire thing. The page structure tags
don't affect what the page looks like when it displays; they're only there to help tools
that interpret or filter HTML files.
At one time, these tags were optional. Even today, if you leave them out of your markup,
browsers usually can read the page anyway. These tags, however,
are
required elements
in HTML 4/XHTML 1.1 and HTML5, the standards supported by current browsers.
The
DOCTYPE
Identifier
Although it's not a page structure tag, the XHTML 1.0 and HTML5 standards include
an additional requirement for your web pages. The first line of each page must
include a
DOCTYPE
identifier that defines the XHTML 1.0 version to which your page
conforms, and the Document Type Definition (DTD) that defines the specification.
This is followed by the
<html>
,
<head>
, and
<body>
tags. In the following example,
the HTML5 document type appears before the page structure tags:
<!DOCTYPE html><html>
<head>
<title>Page Title</title>
</head>
<body>
...your page content...
</body>
</html>
Refer to Lesson 18, “Writing Good Web Pages: Do's and Don'ts,” for more informa-
tion about the
DOCTYPE
tag, and more information about the differences between the
various document types.
The
<html>
Tag
The first page structure tag in every HTML page is the
<html>
tag. It indicates that the
content of this file is in the HTML language. In the XHTML 1.0 recommendation, the
<html>
tag should follow the
DOCTYPE
identifier (as mentioned in the previous note) as
shown in the following example.