简体   繁体   中英

IE9 Is Using Conditional IE7 Stylesheet

I have the following extra stylesheets to deal with some naughty browser behaviour in older versions on Internet Explorer:

    <!--[if IE 8]>
    <link rel="stylesheet" href="/CallCentre/ServiceCloud/Content/IE8.css">
    <![endif]-->
    <!--[if IE 7]>
    <link rel="stylesheet" href="/CallCentre/ServiceCloud/Content/IE7.css">
    <![endif]-->

The problem I have is that a rule that only exists in IE7.css is being applied in Internet Explorer 9.

Why is IE9 using my conditional IE7 stylesheet?

Updated

Oded and hsalama are heading in the right direction.

If I use:

<meta http-equiv="X-UA-Compatible" content="IE=edge">

Or

<meta http-equiv="X-UA-Compatible" content="IE=9">

It loads "Browser Mode: IE9 Compat View".

If I remove this tag is runs in IE7 mode.

Unsure as to why it's picking that up because that all looks right to me, but you can try and force it to use the best rendering mode with the following meta tag, if you don't already have it in there:

<!-- Force best rendering mode for IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge" >

Try the following:

<!--[if lte IE 7]>

This should only load the stylesheets for IE7 or lower (lte = less-than or equal). May this will help.

Or well, you should take a look here: Why is Stylesheet loaded when Contional Comment states it should be ignored?

I don't have IE9 installed, but in IE8 there was this button where you can switch between modes. Also from the tools menu you can specify if it would run in comp view for local sites and local intranet sites, I recall that was the default, not sure if MS cleared that mess in IE9.

Is the site on an intranet? If so that is the default, but the meta tag should correct that. http://windows.microsoft.com/en-us/windows7/How-to-use-Compatibility-View-in-Internet-Explorer-9

This appears to be a bug in the IE Developer Tools. If I run the page on most machines it works as expected and doesn't load the IE7 styles. With Developer Tools open, it seems to jump to IE7 mode in the Developer Tools for some inexplicable reason. The problem only occurs with developer tools open.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM