好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

史上最全的csshack(ie6-9,firefox,chrome,opera,safari)_ht

在这个浏览器百花争鸣的时代,作为前端开发的我们为了我们漂亮的设计能适应各个浏览器可为煞费苦心,主要体现在javascript和css上面。javascript我这次就不谈了,先说说css。

为了适应不同浏览器不同的版本(版本主要就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 45     

test

查看更多关于史上最全的csshack(ie6-9,firefox,chrome,opera,safari)_ht的详细内容...

  阅读:36次