views:

233

answers:

2

With an XML prolog like

? xml version="1.0" encoding="iso-8859-1"? >

and a Doctype like

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

I can get my page to render as expected. However, in IE7 the same page does not render correctly. (a span inside a div does not align vertically) Articles on the web suggest that XML prolog + doctype will throw IE6 into quirks mode. However the article below seems to suggest otherwise, although it does not mention the version (is it 6 or 7) it applies to

http://blogs.msdn.com/ie/archive/2005/09/15/467901.aspx

The article is dated sep 2005 which makes me believe it applies to IE6

Question: Does XML Prolog + doc type throw IE6 into quirks mode? What about IE7?

Any recommendations on for or against using the prolog + doctype

TIA

+2  A: 

Adding an XML prolog before the doctype will throw IE6 into quirks rendering mode. (See here.) In fact, any space before the doctype will throw IE6 into quirks mode. This is not the case for IE7 and above. You can use document.compatMode (example) to have the browser tell you what mode it is using to do the rendering.

The IE blog entry on MSDN is referring to changes made to IE7 that allow IE7 to stay in standards mode when using the appropriate doctype even if it is preceded by an XML prolog.

I would generally recommend omitting the prolog and keeping the browser in standards mode; I think this will make your life easier moving forward.

David Kolar
A: 

@David I read that article but am unable to determine if it was written after the IE Team blog post. I cant seem to find a definitive answer. Part of the problem is that with the prolog and doctype rendering in IE6 and Firefox 3.0 is identical which leads me to assume that IE6 is rendering in standards compliance mode.

rams