Summary of css hack including ie6-11, chrome, opera, firefox_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:58:22
Original
895 people have browsed it

 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>
Copy after login

其中 由于:root 权重较大 所以 ie10 和 ie11 都加了!important。

 

来自 我的博客

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!