Making the switch

Although all of the browsers listed above do some sort of switching, the requirements for switching them into Standards or Almost Standards mode varies somewhat by browser and is influenced by the DTD version and the presence of the complete URL for that DTD. For XHTML documents, the presence of the XML declaration will cause Internet Explorer 6 for Windows and Konqueror to switch into Quirks mode even if the proper DOCTYPE declaration has been provided.

Figuring out which DOCTYPE triggers which mode in every browser can get pretty confusing. For a thorough comparison of browsers’ responses to every possible (X)HTML DTD and URL combination, see the chart created and maintained by Henri Sivonen at http://hsivonen.iki.fi/doctype/.

To summarize here, these are your best bets for triggering Standards or Almost Standards mode in the most browsers that do DOCTYPE switching :

  • XHTML 1.0 Strict or Transitional or XHTML 1.1, with a complete URL (including http://) and without the XML declaration. If the URL is omitted or incomplete, some browsers revert to Quirks mode. Including the XML declaration causes Internet Explorer 6 to revert to Quirks mode, however, this has been corrected in IE 7.

  • HTML 4.0 or 4.01 Strict DTD, with or without the URL. (Omitting the URL triggers Quirks mode in IE 5/Mac with the 4.01 Strict DTD only.)

  • HTML 4.0 or 4.01 Transitional DTD, with the URL http://www.w3.org/TR/html4/loose.dtd (for all browsers but Konquerer 3.2). Including http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd ...

Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.