Choosing DOCTYPEs

> The right DOCTYPE, huh? There is absolutely NO dependable documentation
> anywhere as to just what the "right" DOCTYPE is. Seems to change
> frequently, rendering any attempt to use it futile. If you know more about
> DOCTYPEs than anyone who has posted pages at www.w3.org, then it is time
> for you to tell Planet Earth about your special knowledge!!! We mere
> mortals know nothing of such things, and do not know where to turn. If you,
> Mike, are the one person with the answers, please make sure we have all
> learned your secrets, okay?

Document types are a tool. Like any tool, the right one depends on the
job you need to do. There is no secret information or magic involved
in choosing the right document type - just a little careful thought.
I'm sure the good folks at W3C are aware of all this, as they include
the public identifiers for the document type in their proposals. They
may have considered this subject to be sufficiently simple and well
covered elsewhere to not warrant a description on their web server. I
would have agreed with them until now.

So here's some simple advice on choosing correct doctypes.

First, if you don't plan on making sure the document is a valid
instance of some type, the correct action is to NOT put on a doctype.
Browsers that care about them will correctly assume that they are
dealing with an unvalidated document of unknown type.

Otherwise, if you're using HTML 2.0, then you should probably use:

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

Note that this is what documents of type "text/html" are assumed to be
if they don't have a DOCTYPE line. If you don't use forms and want the
reader to know it, you can use:

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

There is a more stucturally rigid variation of those two specified by
one of:

	<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict//EN">
	<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 1//EN">

In practice, I normally just use the default one.

If you want to use somebodies extensions to HTML, you should use the
public identifier they propose for that document type. If the people
who proposed the extension have failed to provide these, then you'll
either have to take that responsibility on yourself, or find someone
else who has.

If you want to combine extensions from two different groups, then
you're producing a document that isn't a valid instance of either
type, and so shouldn't use either one. You'll once again have to
produce or find one. If you're going to produce one, this would be a
good time to make sure that everything in your new document type is
either interpreted the same way in both document types, or properly
ignored by applications that process the one that doesn't include it.

	<mike

Received on Wednesday, 14 February 1996 15:26:30 UTC