zoukankan      html  css  js  c++  java
  • 区分各浏览器的CSS hack(包括360、搜狗、opera)

        虽然说使用css hack来解决页面兼容性bug并不是个好办法,但是有时候这些hack还是用的着的,比如你接受了一个二手或是三手的遗留界面,杂乱无章的css代码,只在某个浏览器下有兼容bug,而且需要短时间内处理。

        下面一段代码可以让你很快利用css来为特定的浏览器指定样式。不多赘述,看码即懂:

    属性过滤:
    _height:10px; /* IE6支持 */
    *height:10px; /* IE6、IE7支持 */
    height:10px/; /* IE8支持 */
    
    
    选择器过滤:
    
    /*针对IE6*/
    * html #nav{  margin:12px;  }
    
    
    /*针对IE7*/
    *+html #nav{  margin:11px; }
    
    
    
    /*针对Firefox*/
    @-moz-document url-prefix() {
        #nav{ width:200px; }
    }
    IE7、Firefox共用
    height: 100px !important(优先级)
    
    
    /*针对Safari & Chrome* 360 搜狗/
    @media screen and (-webkit-min-device-pixel-ratio:0) {
        #nav{ 300px; }
    }
    
    
    /*针对Opera*/
    @media all and (-webkit-min-device-pixel-ratio:10000), not all and (-webkit-min-device-pixel-ratio:0) {
        #nav{ width:400px; }
    }
  • 相关阅读:
    swift -- 静态变量static
    swift -- 单例+ lazy懒加载 + 第三方库
    swift -- 代理delegate
    swift -- 闭包
    swift -- 构造/析构函数
    swift -- 继承
    swift -- as / 扩展
    swift -- 类中的方法
    swift -- 类和结构体
    C 扩展库
  • 原文地址:https://www.cnblogs.com/lvdabao/p/3189771.html
Copyright © 2011-2022 走看看