问题
Is there a way to trigger standards mode in IE7 when using the HTML5 doctype?
My document starts like this:
<!DOCTYPE html>
<html>
<head>
...
回答1:
F12 opens Developer Tools in IE 9. Alt+7, Alt+8, & Alt 9 will allow you to toggle between browser versions. There are also menus that allow you to change both document and standards modes.
A couple things:
If you are trying to view the DOM tree using the developer tools and switching between different versions in compatibility mode, you should know that you need to refresh each time you switch modes. Otherwise you won't be able to see the tree.
Also, these emulations are not exactly like the original browsers. It really is impossible to see "the way another browser would render" a page unless you are on that other browser.
I recommend using browsershots.org. It's free, and requires no download. If you want to get really sophisticated, there are other options. However I recommend browsershots. Just beware that it takes a few minutes to get a couple images back, and there is a maximum limit per day. You can raise that a bit by registering your account.
回答2:
Use <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
in the head section.
来源:https://stackoverflow.com/questions/5036315/standards-mode-in-ie7-with-html5