css hack


瀏覽器模式hack:
<!--[if IE]> 全部的IE可識別 <![endif]--> 
<!--[if !IE]><!--> 除IE外均可識別 <!--<![endif]--> 
<!--[if IE 6]> 僅IE6可識別 <![endif]--> 
<!--[if lt IE 6]> IE6如下版本可識別 <![endif]--> 
<!--[if gte IE 6]> IE6以及IE6以上版本可識別 <![endif]-->
 <!--[if IE 7]> 僅IE7可識別 <![endif]--> 
<!--[if lt IE 7]> IE7如下版本可識別 <![endif]-->
 <!--[if gte IE 7]> IE7以及IE7以上版本可識別 <![endif]-->
 <!--[if IE 8]> 僅IE8可識別 <![endif]-->
 <!--[if IE 9]> 僅IE9可識別 <![endif]-->
文檔模式hack
 .hack{
background-color:#FFF;
background-color:#FFF\9\0;  \* ie9 *\
background-color:#FFF\0;  \* ie8+ie9 *\
*background-color:#FFF; \* ie6+ie7 *\
+background-color:#FFF; \* ie7 *\
_background-color:#FFF; \* ie6 *\
}
:root .hack{background-color:#F60; \* ie 9 *\}

 
/* Chrome, Safari, Firefox */
 @media all and (min-width:0) { }
———————————————————————————
/* Chrome, Safari */
 @media screen and (-webkit-min-device-pixel-ratio:0) { }
———————————————————————————
/* IE6+ */
 .class {
 color: red\9;
 }
———————————————————————————
/* IE8+ */
 .class {
 color: red\ 0;
 }
———————————————————————————
/* IE8 only */
 @media \ 0screen { }
———————————————————————————
 /* IE9 only */
 :root .class { }
———————————————————————————
/* 目前只發現 color、background-color 能夠這樣區分IE8和IE9 */
 .class {
 color: red\ 0; /* IE8+ */
 color: blue\9\ 0; /* IE9 only */
 }
相關文章
相關標籤/搜索
本站公眾號
   歡迎關注本站公眾號,獲取更多信息