CSS只适用于IE8在兼容模式(没有IE8没有IE7)? [英] CSS to apply only on IE8 in compatibility mode (no IE8 no IE7)?

查看:255
本文介绍了CSS只适用于IE8在兼容模式(没有IE8没有IE7)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法可以添加一个css,它只适用于IE8在兼容模式,但不会,如果IE7或IE8或(显然任何其他浏览器)



我的CSS很琐碎

  h1 {
font-size:14px;
}

但是必须使用font-size才能在IE8(兼容模式) / p>

注意:
我知道如何写一个条件语句来识别IE8 ...但我不知道如何做到IE8兼容模式。 / p>

解决方案

不幸的是没有办法只适用于IE8兼容模式。但是,IE8CM将显示完全相同的IE7,因为它是一个IE7模拟器。您可以使用像下面的代码,但它也将适用于IE7:

 <! -  IE9兼容模式& ; IE8: - > 
<! - [if IE 8]>
< p>欢迎使用Internet Explorer 8.< / p>
<![endif] - >

<! - IE8兼容模式& IE7: - >
<! - [if IE 7]>
< p>欢迎使用Internet Explorer 7.< / p>
<![endif] - >

有任何理由不能同时适用于IE7吗?任何黑客,你正在做,将解决一个问题兼容性模式在IE8中也应该在IE7中需要。


is there a way to add a css which will work only for IE8 in compatibility mode, but will not if IE7 or IE8 or (obviously any other browser) ???

My CSS is trivial

h1 {
   font-size:14px;
}

but that must font-size must only work on IE8 (compatibility mode)

NOTE: I know how to write a conditional statement to spot IE8... but I don't know how to do it for IE8 compatibility mode.

解决方案

Unfortunately there is no way to apply to just IE8 Compatibility mode. However, IE8CM will display exactly the same IE7, because it is an IE7 emulator. You could use something like the following code, but it will also apply to IE7:

<!--IE9 compatibility mode & IE8:-->
  <!--[if IE 8]>
    <p>Welcome to Internet Explorer 8.</p>
  <![endif]-->

<!--IE8 compatibility mode & IE7:-->
  <!--[if IE 7]>
    <p>Welcome to Internet Explorer 7.</p>
  <![endif]-->

Is there any reason that it can't also apply to IE7? Any hack that you're doing that would fix a problem compatibility mode in IE8 should also be needed in IE7.

这篇关于CSS只适用于IE8在兼容模式(没有IE8没有IE7)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆