1 <!DOCTYPE html> 2 3 <html> 4 5 <head> 6 7 <title>Css Hack</title> 8 9 <style> 10 11 #test 12 13 { 14 15 width:300px; 16 17 height:300px; 18 19 20 21 background-color:blue; /*firefox*/ 22 23 background-color:red\9; /*all ie*/ 24 25 background-color:yellow\0; /*ie8*/ 26 27 +background-color:pink; /*ie7*/ 28 29 _background-color:orange; /*ie6*/ 30 31 } 32 33 :root #test { background-color:purple\9; } /*ie9*/ 34 35 @media all and (min-width:0px){ #test {background-color:black\0;} } /*opera*/ 36 37 @media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} } /*chrome and safari*/ 38 39 </style> 40 41 </head> 42 43 <body> 44 45 <div id="test">test</div> 46 47 </body> 48 49 </html>
原文:http://www.cnblogs.com/Tourmaline/p/3870049.html