I ran into an infuriating problem today which made my web page explode.
After some fussing with IE-conditional CSS, thinking I was losing my touch at getting my stuff to work in IE from the start, I started comparing two pages uses Internet Explorer’s Developer Tools, one working and one not, both very similar.
After some looking I noticed that my DOCTYPE in the broken one was winding up commented out (HTML comment). I went and looked, thinking I must have commented it out to test something and forgot, but it was commented.
Finally I realized that the HTML comment I had on the first line was causing the DOCTYPE to also be treated as being commented out.
Has anyone else ran into this problem before? I couldn’t find anything about it on Google, so I’m a bit curious.
Yes, I don’t know the details, but generally it’s an absolute no no to have anything above the doctype. If you are using real XHTML you can but an xml declaration above there, but that will crash IE8 and under, though I presume it works for IE9. But as a rule, don’t put anything else up there.
Huh. It looks like you aren’t using the standard HTML4 doctype, so maybe the same rules don’t apply? I wonder if anything changed for XHTML also. Meh, IE … can’t live with it, can’t live without it …