0

NOTE: I am answering my own question, since I was not able to find any reference here in SE to this particular bug on which I stumbled upon and found the fix accidentally. Hope it helps someone . . . . .

 <!-- some comment-->
 <! DOCTYPE html>
  . . . . .come css3 stuff here

The above html works perfectly in Mozilla and Chrome . . .But, why it is not working in IE9?

ANSWER:

In IE9, document declaration should not have any comments before them, apparently. The following code will work in IE9

 <! DOCTYPE html>
 <!-- some comment-->
  . . . . .come css3 stuff here

I don't know why this is the case, but I was breaking my head over this issue, as I have some other files working perfectly in IE9 (they didn't have comments before doc type) . . .I reinstalled IE9, finally found this issue . . .

Hope it helps . . . .

palerdot
  • 6,150
  • 3
  • 36
  • 42
  • possible duplicate of [HTML5 doctype putting IE9 into quirks mode?](http://stackoverflow.com/questions/6529728/html5-doctype-putting-ie9-into-quirks-mode) – AlfonsoML Aug 20 '12 at 19:03
  • This has always been known. IE looks at the first few chars of a document alone to determine quirks mode. But you only gave us 20 min to answer you. – Rob Aug 20 '12 at 19:26

1 Answers1

1

Placing anything before the Doctype causes it, not just comments.

Blank lines will trigger it also.

W3C recommendation is that you put nothing before the Doctype in any browser, even those that tolerate chars before it such as Chrome and FF.

shawty
  • 5,447
  • 2
  • 29
  • 66