1 2 3 4Css Hack ie各版本 opera chrome safari firefox 5 6 7 #test 8 { 9 width:300px; 10 height:300px;11 12 background-color:blue; /*firefox*/13 background-color:red9; /*all ie*/14 background-color:yellow; /*ie8*/15 +background-color:pink; /*ie7*/16 _background-color:orange; /*ie6*/17 } 18 :root #test { background-color:purple9; } /*ie9*/19 @media all and (min-width:0px){ #test {background-color:black;} } /*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 26 27 28css hack 测试29 30
登录后复制
其中 由于:root 权重较大 所以 ie10 和 ie11 都加了!important。
来自 我的博客
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至253000106@qq.com举报,一经查实,本站将立刻删除。
发布者:PHP中文网,转转请注明出处:https://www.chuangxiangniao.com/p/2839424.html