Page is a not externally linkable
- Code, Content, and Presentation
-- CSS
---- whitespace before Doctype and Quirks Mode


SuzyUK - 9:31 pm on Apr 10, 2008 (gmt 0)


Wondering how one can see if IE (per version if different) is in quirks mode without changing content

<p>Which Mode?</p>
<h2><script type="text/javascript">
mode = document.compatMode;
document.write(mode);
</script></h2>
<hr>
<ul><li>BackCompat = Quirks Mode</li>
<li>CSS1Compat = Standards Compliance Mode</li></ul>

Not certain where this is headed?

Me neither.. I just read somewhere today that whitespace won't trigger Quirks if indeed it is really whitespace - I don't understand that?

I can see that multiple returns don't trigger backCompat mode those are done in an editor that that presumes to know the encoding.. I can't help but think this could be a throwback to the days when windows text editors

I got to reading some before I ran out of time (and asked here) and landed down the road of BOM and character encoding and how the old "headers already sent message" in PHP explained that whitespace was not always as it appeared..

I just want to see if there's still any good reason to advise no whitespace before Doctype for IE CSS troubles.

yes SWA, anything at all (with the possible exception of 'true' whitespace?) before the Doctype causes Quirks in IE6 this is partially still true of IE7, except for it the <xml prolog> no longer triggers quirks and possibly, depending on the outcome here, neither does whitespace.. a good ol' comment does though as does a simple "<!>"

I think the thing I see mainly when troubleshooting is - if there's a huge amount of whitespace before a Doctype it's usually been generated by some server side code. ASP.Net is bad but I don't know why, does their "runat" code, sorry terminology is probably wrong, generate something?


Thread source:: http://www.webmasterworld.com/css/3623733.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com