Thursday, January 1, 2009

DOCTYPEs

What better way to start off the new year than to make sure you are starting your (X)HTML documents correctly. For those of you following Web standards (and I know all of you are, right?), here's a list of the Document Type Definitions that can be used at the beginning of your (X)HTML documents. For you newer developers, don't forget that the DTD is the one tag you don't close (/>). Even if you code your document correctly, the lack of a DTD can throw your Web page into Quirks mode. Some WYSIWYG editors insert incorrect DOCTYPEs that use relative links rather than the full link so beware of that as well.

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

  • XHTML 1.0 Strict - Frames and deprecated HTML tags and attributes are not allowed. Must be XML compatible.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

  • XHTML 1.0 Transitional - Allows the use of deprecated HTML tags and attributes. Frames are not allowed. Must be XML compatible.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

  • XHTML 1.0 Frameset - Allows the use of frames and deprecated HTML tags and attributes. Must be XML compatible.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

  • HTML 1.0 Strict - Frames and deprecated HTML tags and attributes are not allowed.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

  • HTML 1.0 Transitional - Allows the use of deprecated HTML tags and attributes. Frames are not allowed.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

  • HTML 1.0 Frameset - Allows the use of frames and deprecated HTML tags and attributes.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

NOTE: There are more DTDs to choose from, but these should be sufficient.

No comments: