Productivity tips, reviews, tools, software and gadgets.

Doctype Blues In IE6
So you're going to validate your old table-based website with a good HTML validator to make it a bit standard compliance.

First thing you notice is that somehow you didn't set your doctype... No problem, you think, we just paste this suggested doctype declaration and we're all set:

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

Omg! Your whole layout is screwed up in Internet Explorer 6! Although you clearly specified an old html standard (4.01) and specifically pointed at the "loose" specification at the W3C, it changes the output totally in IE6. Why is that?

Apparently IE6 sometimes switches to standards compliance mode, depending on the doctype specified. The solution for your old table-based website (which you'd better rewrite with proper CSS layout someday anyway) is to use this declaration:

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

The subtle difference is that you sometimes shouldn't specify the url of the W3C-dtd if you don't want IE switching into standards compliance mode.

Here's an overview of when IE6 switches to standards compliance mode:
DOCTYPEURL PresentURL Not Present
No DOCTYPE presentoffoff
HTML (no version)offoff
HTML 2.0offoff
HTML 3.0offoff
HTML 4.0onon
HTML 4.0 Framesetonoff
HTML 4.0 Transitionalonoff
HTML 4.0 Strictonon
Unrecognized DOCTYPEonon

(Table source: MSDN)
  Posted by oVan on Friday, September 16, 2005 | PermaLink | 0 comments
« SuperWasp start page