Document Types

 <  Day Day Up  >  


HTML follows the SGML notation for defining structured documents. From SGML, HTML inherits the requirement that all documents begin with a < !DOCTYPE> declaration. In the most basic sense, this line identifies the HTML " dialect " used in a document by referring to an external document type definition, or DTD . A DTD defines the actual elements, attributes, and element relationships that are valid in documents. The < !DOCTYPE> declaration allows validation software to identify the HTML DTD being followed in a document, and verify that the document is syntactically correct ”in other words, that all tags used are part of a particular specification and are being used correctly. The process of validation is discussed in greater depth in Chapter 2.

Note  

Today browsers are aware of the <!DOCTYPE> and standards-compliant browsers will examine it to determine what rendering mode to enter. This process is often dubbed the "doctype switch" and is used by browsers to quickly determine if a standards-compliant parse of the page should be employed or if the browser should enter into "quirk" mode and assume that a less stringent form of HTML is being used. Because of this, HTML/XHTML document authors should always use the <!DOCTYPE> statement properly.

There are numerous HTML and XHTML DTDs that can be used, corresponding to the various standard versions of HTML in existence. In the past, even some proprietary forms of HTML had their own doctype statements. At the time of this edition's writing, the < !DOCTYPE> most likely in use is either the HTML 4.0 transitional form, as shown here:

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">  

or the HTML 4.01 transitional specification indicated by

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">  

However, these forms are not quite specific enough and should actually specify the location of the DTD being used, as shown here:

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

In the future, the stricter form of HTML ”XHTML ”probably will be more commonly used. It is indicated by

  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  

There are numerous document type identifiers that could be used at the start of the document, as shown in Table 1-1.

Table 1-1: Common HTML Doctype Declarations

HTML Version

!DOCTYPE Declaration

2.0

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">

3.2

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

4.0 Transitional

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

4.0 Frameset

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

4.0 Strict

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

4.01 Transitional

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

4.01 Frameset

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

4.01 Strict

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

XHTML 1.0 Transitional

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

XHTML 1.0 Strict

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

XHTML 1.0 Frameset

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

XHTML 1.1

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

XHTML 2.0 (still in progress)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 2.0//EN" " http://www.w3.org/TR/xhtml2/DTD/xhtml2.dtd ">

Note  

On occasion, you might see other HTML document type indicators, notably one for the 3.0 standard that was never really adopted in the Web community.

While XHTML is almost certainly the future of HTML, the fact of the matter is there will be multiple forms of HTML in use on the Web for a long time. Document authors should be familiar with the many forms of HTML. A brief explanation of each version of HTML is provided in Table 1-2.

Table 1-2: Description of Common HTML Versions

HTML Version

Description

2.0

Classic HTML dialect supported by browsers such as Mosaic. This form of HTML supports core HTML elements and features such as tables and forms but does not consider any of the browser innovations of advanced features such as style sheets, scripting, or frames .

3.0

The proposed replacement for HTML 2.0 that was never widely adopted, most likely due to the heavy use of browser-specific markup.

3.2

An HTML finalized by the W3C in early 1997 that standardized most of the HTML features introduced in browsers such as Netscape 3. This version of HTML supports many presentation elements, such as fonts, as well as early support for some scripting features.

4.0 Transitional

The 4.0 transitional form finalized by the W3C in December of 1997 preserves most of the presentation elements of HTML 3.2. It provides a basis for transition to CSS as well as a base set of elements and attributes for multiple language support, accessibility, and scripting.

4.0 Strict

The strict version of HTML 4.0 removes most of the presentation elements from the HTML specification, such as fonts, in favor of using Cascading Style Sheets (CSS) for page formatting.

4.0 Frameset

The frameset specification provides a rigorous syntax for framed documents that was lacking in previous versions of HTML.

4.01 Transitional/Strict/Frameset

A minor update to the 4.0 standard that corrects some of the errors in the original specification.

XHTML 1.0 Transitional

A reformulation of HTML as an XML application. The transitional form preserves many of the basic presentation features of HTML 4.0 transitional but applies the strict syntax rules of XML to HTML.

XHTML 1.0 Strict

A reformulation of HTML 4.0 strict using XML. This language is rule enforcing and leaves all presentation duties to technologies such as Cascading Style Sheets (CSS).

XHTML 1.1

A minor change to XHTML 1.0 that restructures the definition of XHTML 1.0 to modularize it for easy extension. It is not commonly used at the time of this writing and only offers minor gains over XHTML 1.0.

XHTML 2.0

A new implementation of XHTML circa 2003 that may not provide backward compatibility with XHTML 1.0 and traditional HTML. XHTML 2 will likely remove most or all presentational tags left in HTML and will introduce even more logical ideas to the language.

The browser vendors also have provided their own various extensions to HTML. While many of the elements introduced should not be used, some of the innovations made by browser vendors eventually were adopted as part of the standard. Web page authors also should be aware of the primary contributions of each browser as well as the core version of HTML supported, both for browser compatibility as well as understanding the historical changes the Web has undergone. Table 1-3 lists a few of the major browser versions and summarizes some of their element introductions .

Table 1-3: Web Development Feature Overview By Browser Version

Browser

Features Introduced

Standards Support

Netscape 2. x

Java, JavaScript, Frames, Plug-ins

2.0 and Netscape extensions, many of which became 3.2 standard.

Netscape 3. x

A few proprietary elements such as spacer and multicol

3.2 with Netscape extensions.

Netscape 4. x

Basic CSS support and the proprietary HTML element layer

3.2, part of 4.0, part of CSS1, and Netscape extensions.

Netscape 6 .x

Heavy standards support

4.0, CSS1, much of CSS2, good portion of Document Object Model.

Netscape 7. x / Mozilla 1. x

Very heavy standards support, minor CSS extensions, link prefetching

4.0, XHTML 1.0, CSS1 and most of CSS2, nearly all DOM 1 and 2.

Internet Explorer 3.0

Frames and Inline Frames, Jscript, ActiveX controls, VBScript, some proprietary HTML elements such as marquee and bgsound

3.2 with some Microsoft extensions and a limited amount of CSS1.

Internet Explorer 4.0

Significant JavaScript access to page elements

Most of 4.0 with Microsoft extensions, most of CSS1.

Internet Explorer 5.0/5.5/6.0

Native XML support, close to full Document Object Model Level 1

4.0 with Microsoft extensions, most of CSS1, most of the Document Object Model 1. XHTML support in IE 6. Still certainly underlying reliance on IE flavored syntax.

Opera 7.0

Very heavy standards focus, focus on accessibility and speed features and related W3C specifications

4.0 and XHTML, most CSS1 and Document Object Model 1. Pre 7.0 versions of Opera had problems with JavaScript and advanced CSS.

WebTV/MSN TV

Proprietary tags useful for television screen layout and integration with television viewing

3.2 with WebTV/MSN TV extensions. Support for many Netscape and Microsoft extensions.

It is very important for document authors to know the various versions of < !DOCTYPE> declarations, as well as extensions made by the browser vendors. When checking syntax, it is important to understand that strict adherence to W3C specifications is not currently a reasonable goal, given the lack of browser support and widespread use of HTML extensions. One day, if XHTML becomes all that is promised , we will simply follow the specifications as written for correct document construction. Right now, however, that ideal environment seems far off. Even with standards-oriented browsers emerging, bugs and rendering differences continue to plague Web developers. For now, page authors should find the common ground among their browser population, be it HTML 4 or XHTML, and try to stick to what is standard as best as possible.



 <  Day Day Up  >  


HTML & XHTML
HTML & XHTML: The Complete Reference (Osborne Complete Reference Series)
ISBN: 007222942X
EAN: 2147483647
Year: 2003
Pages: 252
Authors: Thomas Powell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net