Document type declaration

A valid HTML or XHTML document has to include a document type declaration, which specifies which version of HTML or XHTML is used in the document. There is usually no harm in leaving it out as browsers ignores this information, but other tools such as validators often require a document type declaration.

Alpha also uses the document type declaration to only let you use the HTML elements and attributes belonging to the HTML or XHTML version specified. If a document contains a document type declaration then Alpha does the following.

Note. Alpha understands the document type declarations for HTML 4.0 and 4.01 and XHTML 1.0 and 1.1 and ignores all other ones.

The specification for HTML 4.0 was released 18 December 1997 and HTML 4.01, which is a small update was released 24 December 1999. HTML 4.01 is the current [July 2003] official version of HTML. The specification for XHTML 1.0 was released 26 january 2000, and the specification for XHTML 1.1 was released 31 May 2001.

HTML 4.01 and XHTML 1.0 both specifies three document type definitions (DTDs), which vary in the elements they support.

Strict
Includes all elements and attributes that have not been deprecated (see below) or do not appear in frameset documents. For HTML documents that use this DTD, use this document type declaration:

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

For XHTML documents that use this DTD, use this document type declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">

Transitional
Includes everything in the strict DTD plus deprecated elements and attributes (most of which concern visual presentation such as alignment and colors). For HTML documents that use this DTD, use this document type declaration:

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

For XHTML documents that use this DTD, use this document type declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">

Frameset
Includes everything in the transitional DTD plus frames as well. For HTML documents that use this DTD, use this document type declaration:

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

For XHTML documents that use this DTD, use this document type declaration:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN">

This document type declaration must be used and should only be used for documents defining the frames layout, i.e. documents containing FRAMESET and FRAME elements. For documents defining the content of the frames use either the strict or transitional DTD. If you want to use the attribute TARGET, then you have to use the transitional DTD.

XHTML 1.1

XHTML 1.1 is very similar to XHTML 1.0 Strict, but has been defined to be module-based. Its document type declaration is

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">

Deprecated elements and attributes

Some elements and attributes are defined as deprecated in the HTML 4.01 and XHTML 1.0 specifications. A deprecated element or attribute is one that has been outdated by newer constructs such as style sheets. Deprecated elements may become obsolete in future versions of HTML.

The deprecated elements are APPLET, BASEFONT, CENTER, DIR, FONT, ISINDEX, MENU, S, STRIKE, and U. The deprecated attributes are mostly the ones which concerns presentation, such as alignment and colors.

Extensions to HTML 4.01

Alpha support some extensions to HTML 4.01 which were introduced by Netscape or Microsoft. For documents with a HTML 4.01 document type declaration these are obviously disabled. If you want to use extensions do not use a document type declaration in your documents. The elements which are extensions are MULTICOL, SPACER, NOBR, WBR, MARQUEE, BLINK, BGSOUND, EMBED, NOEMBED, KEYGEN, SERVER, LAYER, ILAYER, and NOLAYER.

Preferences related to DTDs

DTD related prefs

In the global attribute preferences dialog you can specify two preferences which are related to the DTDs.

Don't use extensions to HTML 4.01
HTML elements not included in HTML 4.01 will be disabled in the menu, and attributes not included in HTML 4.01 will not be asked about. Exactly the same set of elements and attributes are used as if the document had included a frameset document type declaration.
Don't use deprecated elements and attributes
Deprecated elements will be disabled in the menu and deprecated attributes will not be asked about (this includes the extensions). The set of elements and attributes and those in the strict DTD plus the ones used for frames. Use this setting when you are defining frames documents but don't want to use deprecated elements or attributes.

When any of these two settings apply and there is also a document type declaration in the document, the largest set of elements and attributes allowed both by the settings and the DTD is used.

Previous page Next page