什么是Css Hack?ie6,7,8的hack分别是什么?

针对不同的浏览器写不同的CSS code的过程,就是CSS hack。

示例如下:

1

2

3

4

5

6

7

8

9

10

11

12

#test       {  

        width:300px;  

        height:300px;  

        background-color:blue;      /*firefox*/

        background-color:red\9;      /*all ie*/

        background-color:yellow;    /*ie8*/

        +background-color:pink;        /*ie7*/

        _background-color:orange;       /*ie6*/    } 

        :root #test { background-color:purple\9; }  /*ie9*/

    @media all and (min-width:0px){ #test {background-color:black;} }  /*opera*/

    @media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} }       /*chrome and safari*/

posted @ 2016-11-03 16:56  seedsman  阅读(2079)  评论(0编辑  收藏  举报