IE6 : "*"_“下劃線格 :myclass {_background:red;}"*"星號:格式:.myclass{*background:red;}IE7 : "*“星號格式:.myclass{*background:red;} *+html 格式: *+html .myclass{back...
IE6 : " *"_“下劃線格 :myclass {_background:red;}
"*"星號:格式:.myclass{*background:red;}
IE7 : " * “星號格式:.myclass{*background:red;}
*+html 格式: *+html .myclass{background:red;}
+ 格式: .myclass{+background: red;}
!important 格式: .myclass{background:red !important;}
IE8 : \0 格式:.myclass{background:red\0;}/*是留給ie8的,最新版opera也認識,後面自有hack寫了給opera認的,所以,\0我們就認為是給ie8留的;*/
IE9 : \9\0 è格式:.myclass{background:red\9\0;}
:root加\9 è格式::root .myclass{background:red\9;}
IE10 : @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* IE10-specific styles go here */ }
Firefox : @-moz-document url-prefix() { .font1 {color:red} } /*針對Firefox瀏覽器的寫法*/
Opera :@media all and (min-width:0px){ #test {background-color:black\0;} } 這個是老是跟ie搶著認\0的神奇的opera,必須加個\0,不然firefox,chrome,safari也都認識。。。
chrome/Safari : @media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} }最後這個是瀏覽器新貴chrome和safari的。
總結: 1、IE6、IE7都支持 *,但IE8終於回歸正統,放棄了對*的支持
2、IE7、IE8、Firefox、Opera、Safari都支持!important
3、瀏覽器優先順序別:FF<IE7<IE6,CSS hack,遵循書寫順序一般為FF IE7 IE6
4、 ie9的hack目前ie10也適合