Search code examples
validationxhtmlquirks-mode

Which doctype should I validate to to make IE7 render in standards-mode most easily?


I'm working on a massive website that is supposedly "XHTML 1.0", but it is hopelessly far from being valid XHTML, let alone valid HTML.

We are forced to support IE7, and the invalid code is causing things to break in an un-fixable way in a number of places. I've researched the problem and the only way to fix it is to get IE7 to render the site in standards mode.

Since getting the site to validate is a massive undertaking already, I figure I might as well propose updating to an HTML5 doctype.

But since our primary requirement is to support IE7, and for it to render the page in IE7 standards mode, I wonder if it would be better to validate to an HTML 4.01 transitional doctype or some other doctype.

Thanks in advance.


Solution

  • Looking into it further, it seems that it will be easiest to validate to XHTML 1.0. I'd thought validating to HTML5 would be simpler, but it actually throws more validation errors with an HTML5 doctype than an XHTML doctype. This is because HTML5 doesn't allow a lot of the presentational HTML attributes that are in use. Oddly, HTML5 also catches things like too-few columns in a table row, while XHTML validation doesn't seem to care.

    So generally, it looks like the answer is just to stick with the original doctype. Switching doctypes doesn't solve any of the invalid code and brings in additional invalidities.