首页 > 网站 > WEB开发 > 正文

css hack 总结 包括ie6-11,chrome,opera,firefox

2024-04-27 14:32:46
字体:
来源:转载
供稿:网友

CSS hack 总结 包括ie6-11,Chrome,Opera,Firefox
 1 <!DOCTYPE html>  2 <html>  3 <head>  4 <title>Css Hack ie各版本 opera chrome safari firefox</title>  5 <meta charset=”utf-8&PRime; /> 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。

来自我的博客


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表