有针对IE10的特定CSS选择器吗? [英] Are There Specific CSS Selectors Targeting IE10?

查看:132
本文介绍了有针对IE10的特定CSS选择器吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于IE在10版本中摆脱条件注释,我迫切需要找到一个CSS黑客针对IE10具体。请注意,它必须是选择器,它被黑客攻击,而不是CSS属性。

Since IE is getting rid of conditional comments in version 10, I'm in dire need to find a "CSS hack" targeting IE10 specifically. Note that it has to be the selector that's getting "hacked" and not the CSS-properties.

在Mozilla中,您可以使用: / p>

In Mozilla, you can use:

@-moz-document url-prefix() {
  h1 {
    color: red;
  }
}

在Webkit中,通常执行:

While in Webkit, you usually do:

@media screen and (-webkit-min-device-pixel-ratio:0) {
  h1 {
    color: blue;
  }
}

如何在IE10中做类似的操作? p>

How would I do something similar in IE10?

推荐答案

以下示例说明如何执行此操作

The following example shows how to do this

/* 
 #ie10 will only be red in MSIE 10, 
 both in high contrast (display setting) and default mode 
*/
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
   #ie10 { color: red; }
}

警告:可能会在IE11 +

Warning: will probably work in IE11+, too.

这篇关于有针对IE10的特定CSS选择器吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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