开发者

Is it possible to get IE7 out of quicks mode without using a DOCTYPE?

In this particular situation, I do not have a choice about the DOCTYPE. I cannot use one. It's a weird situation, but it is what it is.

We have some CSS which uses child selectors ("p > a > span", etc.). These worked in IE7, even though we didn't have a DOCTYPE.开发者_运维问答..and then they suddenly stopped working. Something we did caused IE7 to go into quirks mode, and I don't know what that thing was.

I did this:

alert(document.compatMode);

And it came back with "BackCompat," so I know we're in quirks mode, which would make sense because we don't have a DOCTYPE. But we haven't had a DOCTYPE all along, and this was working, which tells me there's some other way to get IE7 out of quirks mode.


You can force IE7 compatibility mode without using a DOCTYPE by setting the X-UA-Compatible header to IE=EmulateIE7 in your web-server and sending this as part of the HTTP headers. See Configuring Web Servers to Specify Default Compatibility Modes for how to do this in IIS or Apache httpd configuration for IE7 standard mode rendering in IE8 for Apache.


hmm maybe this will help?

There are currently two ways of declaring the ISO value in HTML files. One of them is to place the XML prolog on to the very top line of each HTML file, directly before the doctype declaration. Declaring it this way means that the first three lines of each HTML file might look like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

(The first line is the XML prolog; the second and third lines are the doctype declaration.)

By not having the doctype declaration on line 1, Internet Explorer 6 reverts to quirks mode (despite the fact that the above HTML code is perfectly valid). Internet Explorer 7 however will not revert to quirks mode, and will instead render the web page in standards mode. (You may wish to read more about quirks and strict modes, if you haven't heard of these terms before.)

from: http://www.webcredible.co.uk/user-friendly-resources/css/internet-explorer-7.shtml

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜