浏览器模式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 */ }