zoukankan      html  css  js  c++  java
  • CSS属性

    1.  getComputedStyle(属性多)
    获取当前元素所有最终使用的CSS属性值,返回一个只读的对象

         style (属性少)可写

    var dom = document.getElementById('btn')
    var a = window.getComputedStyle(dom,null)
    var b = dom.style
    console.log(a);
    console.log(b);
    

      


    2.currentStyle 与getComputedStyle 作用一样,只不过浏览器适用不一样

    function css(元素, 属性){
        if(obj.currentStyle){ //ie使用
        return obj.currentStyle[属性];
        } else { //火狐与chrome
        return getComputedStyle(元素, 伪类,没有为null)[属性];
        }
    }
    

      


    获取css属性值 :

    1.键值对
    2.getProperValue :window.getComputedStyle(element,伪类).getProperValue('属性名')
    两种方式的不同在于有时值一样,属性名是不一样的

  • 相关阅读:
    type和object详解
    元类+单例
    单表查询和多表查询
    外键
    存储引擎,MySQL中的数据类型及约束
    壹拾壹




  • 原文地址:https://www.cnblogs.com/xiaobai1/p/8732941.html
Copyright © 2011-2022 走看看