views:

2973

answers:

6

Does IE8 run in quirks mode like IE6/7?

I have a webpage that has some truly bizarre code. The content is centered with padding and negative margins.

It works correctly in IE6/7 and other browsers but in IE8 the content area is half as wide and not centered (flag for quirks mode).

The source code has three blank lines before the DOCTYPE. I know that will throw IE6 into quirks mode. Will it also affect IE8?

I don't have access to the source so I cannot remove those lines to test it.

A: 

Yes it does. Internet Explorer's quirks mode is IE5.5. IE6/7/8 switch back to 5.5 when quirks mode is present. So since it was working fine in IE6/7 it's not the quirks mode. There's a "Compatibility View" button in IE8 to address this issue. It's not a good solution to me though. You'll have to check your CSS code.

dalizard
But shouldn't IE6/7 be in quirks mode too since the blank lines are before the DOCTYPE? It looks fine in compatibility mode. It was developed in IE6 and I am thinking they somehow compensated for the quirks mode which is now throwing IE8 for a loop since it is trying to follow the standards (or some of them).
Emily
@Emily, no it won't put IE8 into quirks mode. You can either change the code so that it renders correctly in IE8 or use one of its compatibility modes. It has 6 modes, and since your site was working fine under 6/7 you can add the following <meta> tag:<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />to force IE8 to use the standard IE7 directives when in standards mode. Quirks mode will be 5.5.
dalizard
A: 

IE8 has a compatibility mode which should treat the page the way IE7 would. Have you tried viewing the page in compatibility mode?

Greg D
The page looks fine in compatibility mode.
Emily
A: 

Can you post a link to the page or some of the HTML itself? You could try adding the meta tag to force compatibility mode?

http://www.ditii.com/2008/08/28/ie8-standards-mode-and-ie7-compatibility-mode/

or for more info:

http://blogs.msdn.com/ie/archive/2008/08/27/introducing-compatibility-view.aspx

shanabus
+2  A: 

Running a few quick tests that can be found here seem to indicate that blank lines shouldn't throw IE8 into Quirks Mode (which is different to Compatability Mode that everyone seems to be confusing it with).

I wrote a breakdown on how incredibly confusing the different modes of IE8/7 here and I didn't even include Quirks Mode in the breakdown. A detailed description of Quirks mode can be found here (not for the original question, but others might find it interesting.)

Steerpike
Ah...their doctype is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">According to your chart, that will throw IE8 into quirks mode.
Emily
A: 

Changing the doctype to HTML 5 should fix some problems. I had an issue with min-width in IE8 using Strict doctype.

So changed this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

To this: <!DOCTYPE html>

See here: http://davidnaylor.org/blog/2008/09/ie8-and-max-width.html

neb
A: 

Today, I changed our DOCTYPE from XHTML v1.0 (Strict) to HTML5. I read somewhere that even though the IE's don't recognize the DOCTYPE yet, they will render the page in standards-compliant mode.

When I checked in IE8, the whole page looked whack (we have quite a bit of CSS and other styling). It took a while before I realized that there wasn't anything "wrong" with the CSS, or even IE8 for that matter. However, it WAS rendering in quirks mode.

Inadvertently, I found the answer in the question posted here, specifically this comment: "The source code has three blank lines before the DOCTYPE. I know that will throw IE6 into quirks mode. Will it also affect IE8?"

I don't know about blank lines, but when I made the change, I had used a javascript comment to "hang on to" my old DOCTYPE statement (which was ABOVE the new HTML5 DOCTYPE). Once I removed those lines (which may have included a blank line or two), my sweating stopped and IE8 rendered in standards-compliant mode.

stk