为了适应不同浏览器不同的版本(版本主要就ie来说),ie这朵奇葩现在我们要兼容6-9,它的10也快出来了。。。在ie下我们可以写条件注释来区分ie和其他浏览器,以及ie的版本,这些请大家自行google。这篇文章主要讨论的是css hack。下面废话补多说了,直接上代码
1 2 3 4 5 6 7 Css Hack 8 9 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 40 41 42 43 44 45test
查看更多关于史上最全的csshack(ie6-9,firefox,chrome,opera,safari)_ht的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did107574