IE8 and quirks mode

2019-06-21 08:11发布

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.

6条回答
Lonely孤独者°
2楼-- · 2019-06-21 08:53

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

查看更多
Juvenile、少年°
3楼-- · 2019-06-21 09:00

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

查看更多
forever°为你锁心
4楼-- · 2019-06-21 09:02

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

查看更多
迷人小祖宗
5楼-- · 2019-06-21 09:04

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.

查看更多
Animai°情兽
6楼-- · 2019-06-21 09:06

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.

查看更多
Emotional °昔
7楼-- · 2019-06-21 09:13

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

查看更多
登录 后发表回答