JavaScript EditorDebugger script     Dhtml css 



Team LiB
Previous Section Next Section

Declaring the Document Type

HTML 4.01 requires that a Document Type Declaration (or DocType declaration) be inserted at the top of a Web page to identify the HTML version being used and the level of conformance that is being enforced.

Declaring Conformance

There are three levels of conformance that can be designated for HTML 4.01: strict, transitional, and frameset.

Strict Conformance

A Web page conforming to the strict definition of HTML 4.01 cannot contain deprecated elements or attributes, nor can it contain frameset elements. Generally, deprecation in HTML means that use of an element or attribute is discouraged in favor of more recently added features to achieve the similar or superior results. In HTML 4.01, many of the elements that have been deprecated are utilized to control the presentation of a Web page, rather than to indicate its logical structure. In a document in strict conformance to HTML 4.01, presentation is separated from structure, with Cascading Style Sheets (CSS) controlling presentation and HTML controlling structure. To declare a Web page as conforming to the strict definition of HTML 4.01, you would insert the following DocType declaration at the top of the document:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
              "http://www.w3.org/TR/html4/strict.dtd">

Transitional Conformance

A Web page conforming to the transitional definition of HTML 4.01 can legally include deprecated elements and attributes, but cannot contain any frameset elements. Deprecated elements include the FONT, BASEFONT, and CENTER elements, for instance. Deprecated attributes include the ALIGN attribute (except in tables) and all attributes for setting text, link, and background colors in the BODY element, for instance. To declare a Web page as conforming to the transitional (or "loose") definition of HTML 4.01, you would insert the following DocType declaration at the top of the document:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

That an element or attribute has been deprecated in HTML 4 does not mean that it is not valid. Only obsolete elements and attributes are not valid in HTML 4. You are free to use deprecated elements and attributes as long as you properly declare your document as conforming to the transitional definition of HTML 4.01. One of the main purposes for using styles over deprecated elements and attributes is to improve accessibility. One of the purposes of allowing the use of deprecated elements and attributes, in the transitional version of HTML 4.01, is to provide for backward compatibility with earlier browsers that do not support styles (or do so badly). It also provides an alternative to Web authors who want to avoid the complications and compatibility issues involved in incorporating CSS into their Web pages or who want to stick to an HTML-only solution for Web design. Beginning Web authors should learn how to design Web pages using deprecated elements and attributes, before moving on to learn how to use styles. Using styles in place of deprecated elements and attributes is discussed and demonstrated in more detail in the Sunday Afternoon session, "Working with Styles."

Frameset Conformance

Conformance with the frameset definition of HTML 4.01 is only declared for Web pages containing frameset elements. They can also contain deprecated elements and attributes (nested in the NOFRAMES element). Frameset elements include the FRAMESET, FRAME, and NOFRAMES elements, which are used in creating framed Web sites. To declare a Web page as conforming to the frameset definition of HTML 4.01, you would insert the following DocType declaration at the top of the document:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
   "http://www.w3.org/TR/html4/frameset.dtd">

Inserting a DocType Declaration

The DocType declaration is inserted at the top of a Web page, before the HTML element's start tag. In this session, you will be working with a number of deprecated elements and attributes. Declare your document as conforming to the transitional definition of HTML 4.01:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>

Team LiB
Previous Section Next Section


JavaScript EditorDebugger script     Dhtml css