简体   繁体   English

IE9正在使用条件IE7样式表

[英]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: 我有以下额外的样式表,以处理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. 我的问题是Internet Explorer 9中仅应用了IE7.css中存在的规则。

Why is IE9 using my conditional IE7 stylesheet? 为什么IE9使用我的条件IE7样式表?

Updated 更新

Oded and hsalama are heading in the right direction. 奥德(Oded)和萨拉玛(Hsalama)朝着正确的方向前进。

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". 它加载“浏览器模式:IE9兼容视图”。

If I remove this tag is runs in IE7 mode. 如果删除此标记,则在IE7模式下运行。

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: 不确定为什么选择它,因为一切看起来对我来说都是正确的,但是如果您还没有它,可以尝试通过以下meta标签强制它使用最佳渲染模式:

<!-- 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). 这仅应加载IE7或更低版​​本的样式表(lte =小于或等于)。 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. 我没有安装IE9,但是在IE8中有一个可以在模式之间切换的按钮。 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. 同样从工具菜单中,您可以指定它是否将在本地站点和本地Intranet站点的comp视图中运行,我记得这是默认设置,不确定MS是否可以清除IE9中的混乱情况。

Is the site on an intranet? 该站点在Intranet上吗? If so that is the default, but the meta tag should correct that. 如果是这样,则为默认设置,但meta标记应予以纠正。 http://windows.microsoft.com/en-us/windows7/How-to-use-Compatibility-View-in-Internet-Explorer-9 http://windows.microsoft.com/zh-CN/windows7/How-to-use-Compatibility-View-in-Internet-Explorer-9

This appears to be a bug in the IE Developer Tools. 这似乎是IE开发人员工具中的错误。 If I run the page on most machines it works as expected and doesn't load the IE7 styles. 如果我在大多数计算机上运行该页面,则该页面将按预期工作,并且不会加载IE7样式。 With Developer Tools open, it seems to jump to IE7 mode in the Developer Tools for some inexplicable reason. 打开开发人员工具后,由于某些莫名其妙的原因,它似乎跳到了开发人员工具中的IE7模式。 The problem only occurs with developer tools open. 仅在开发人员工具打开时出现问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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