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
head content
body content
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
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
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:
Search WWH ::

Custom Search