标签:style blog http color io ar div cti sp
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>Css Hack ie各版本 opera chrome safari firefox</title> 5 <meta charset=”utf-8″ /> 6 <style> 7 #test 8 { 9 width:300px; 10 height:300px; 11 12 background-color:blue; /*firefox*/ 13 background-color:red\9; /*all ie*/ 14 background-color:yellow\0; /*ie8*/ 15 +background-color:pink; /*ie7*/ 16 _background-color:orange; /*ie6*/ 17 } 18 :root #test { background-color:purple\9; } /*ie9*/ 19 @media all and (min-width:0px){ #test {background-color:black\0;} } /*opera*/ 20 @media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} } /*chrome and safari*/ 21 @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) { 22 #test { background-color:#00ff00 !important; } /* ie10 */ 23 *::-ms-backdrop, #test { background-color:#00ffff !important; } /* ie11 */ 24 } 25 </style> 26 </head> 27 <body> 28 <div id=‘test‘>css hack 测试</div> 29 </body> 30 </html>
其中 由于:root 权重较大 所以 ie10 和 ie11 都加了!important。
来自 我的博客
css hack 总结 包括ie6-11,chrome,opera,firefox
标签:style blog http color io ar div cti sp
原文地址:http://www.cnblogs.com/tony77/p/3958775.html