IE9下css hack写法

时间:2023-03-09 18:55:36
IE9下css hack写法

IE9下css hack写法

ie9一出css hack也该更新,以前一直没关注,今天在内部参考群mxclion分享了IE9的css hack,拿出来也分享一下:

 select {
background-color:red\0; /* ie 8/9*/
background-color:blue\9\0; /* ie 9*/
*background-color:#dddd00; /* ie 7*/
_background-color:#CDCDCD; /* ie 6*/
}

注意写hack的顺序,其中:

  1. background-color:red\0;IE8和IE9都支持;
  2. background-color:blue\9\0; 仅IE9支持;

感谢mxclion,感谢内部参考群!

===============华丽的分割线===============

今天在http://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx上看到另一种hack:

 #element {
color:orange;
}
#element {
*color: white; /* IE6+7, doesn't work in IE8/9 as IE7 */
}
#element {
_color: red; /* IE6 */
}
#element {
color: green\0/IE8+9; /* IE8+9 */
}
:root #element { color:pink \0/IE9; } /* IE9 */

csshack的更多资料

chrome、safari和opera的专属css hack写法

让Medial Queries支持IE的hack写法