Which HTML DOCTYPE should you use?

There are several HTML document types to choose from.

HTML 4.01 Strict

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

This one is a cut down version of the old HTML 4.1 that forces structure on it's author and is not really good for design artyfarty types.

HTML 4.01 Transitional

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

If you're learning or not concerned with exact HTML (adding depreciated design elements) then this one is for you!

HTML 4.01 Frameset

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

Use for HTML framesets only

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 Transitional

<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"
\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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\">

HTML 3.2
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2 Final//EN\">
Oldie but a goodie. This one will support tables with 100% height.

HTML 2.0
<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">
For cavemen.




Jeffrey Zeldman explains it well over at alistapart
http://alistapart.com/stories/doctype/

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options