`
xixian
  • 浏览: 210909 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

区分ie6-9,firefox,chrome,opera,safari的css方法(hack)

阅读更多
参考http://www.cnblogs.com/wuqiang/archive/2011/08/23/2150240.html

<!DOCTYPE html>  

<html>  

<head>  

    <title>Css Hack</title>  

    <style type="text/css">  

    #test   

    {   

        width:300px;   
        height:300px;   
        background-color:blue;      /*firefox*/
        background-color:red\9;      /*all ie*/
        background-color:yellow\0;    /*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\0;} }  /*opera*/
    @media screen and (-webkit-min-device-pixel-ratio:0){ #test {background-color:gray;} }  /*chrome and safari*/
    </style>  
</head>  
<body>  
    <div id="test">test</div>  
</body>  
</html>
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics