Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE8 and quirks mode

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.

like image 502
Emily Avatar asked Aug 07 '09 14:08

Emily


People also ask

What's the difference between standard and quirks mode?

In quirks mode, layout emulates nonstandard behavior in Navigator 4 and Internet Explorer 5. This is essential in order to support websites that were built before the widespread adoption of web standards. In full standards mode, the behavior is (hopefully) the behavior described by the HTML and CSS specifications.

What is quirks mode in Google Chrome?

Chrome Quirks is a fun extension that allows you to inject pre-loaded effects or custom CSS onto any webpage you visit. Developers can quickly and easily edit CSS and test ideas out. This extension appeals to the curious and the pranksters who can't help messing with their less tech-savvy friends!

How do I know if my browser is in quirks mode?

In Firefox and Opera you can determine if your browser is in "quirks mode" by checking page info. Using document. compatMode , will tell you the mode you are in with most browsers.


3 Answers

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">

To this: <!DOCTYPE html>

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

like image 162
neb Avatar answered Nov 10 '22 17:11

neb


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.)

like image 32
Steerpike Avatar answered Nov 10 '22 17:11

Steerpike


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.

like image 29
stk Avatar answered Nov 10 '22 15:11

stk