HTML and CSS Reference
In-Depth Information
keywords that would aid search engines in directing interested users to the page. The
body element contains all of the content that appears in the rendered Web page. Thus,
the general structure of an HTML fi le is
<html>
<head>
head content
</head>
<body>
body content
</body>
</html>
where head content and body content are the content you want to place within the
document's head and body. Note that the body element is always placed after the head
element.
The Document Type Declaration
Prior to the opening <html> tag, many HTML fi les also include a Document Type
Declaration , or doctype , to indicate the type of markup language used in the document.
The doctype is used by validators , which are programs that examine document code to
ensure that it meets all the syntax requirements of the specifi ed language. All XHTML
fi les require a doctype because those documents must be validated against a set of
standards.
Most current browsers also use the presence or absence of a doctype to decide which
mode they should use to render a document in a process known as doctype switching . If
a doctype is included, such browsers render the Web page in standards mode , in accor-
dance with the most current specifi cations of the language. If no doctype is provided,
these browsers render the document in quirks mode based on practices followed in the
1990s. The differences can be striking. Figure 1-2 shows an example of two documents
rendered by Internet Explorer under standards mode and quirks mode. The only differ-
ence in the code between these two documents is the presence or absence of a doctype,
but the browser renders the two documents very differently.
Figure 1-2
A Web page rendered in standards mode and quirks mode
Standards mode
Quirks mode
Different HTML versions have different doctypes. The doctype for HTML 4.01 is:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01/EN”
ƒƒ“ http://www.w3.org/TR/html4/strict.dtd”>
 
Search WWH ::




Custom Search