CSS 更直接有效的hack 写法

以前在用的css hack(这里主要针对ie,用color举例)css

div{html

    *color:red;    /* IE6    IE7 */css3

    color:red\0;     /* IE6    IE7    IE8    IE9    IE10 */htm

    color:red\0;     /* IE8    IE9    IE10 */ast

    _color:red;    /* IE6 */hack

}di

可是IE9 支持部分css3 好比圆角,IE8如下的hack就不是很好用,因此就用了下面的方式co

*html *前缀只对IE6生效
*+html *+前缀只对IE7生效
@media screen\9{...}只对IE6/7生效
@media \0screen {body { background: red; }}只对IE8有效
@media \0screen\,screen\9{body { background: blue; }}只对IE6/7/8有效
@media screen\0 {body { background: green; }} 只对IE8/9/10有效
@media screen and (min-width:0\0) {body { background: gray; }} 只对IE9/10有效
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {body { background: orange; }} 只对IE10有效
相关文章
相关标签/搜索