首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

getComputedStyle与currentStyle

document.getElementById("elem-container"); var theCSSprop = window.getComputedStyle(elem,null).getPropertyValue...getComputedStyle和element.currentStyle主要存在以下区别: a.前者在很多浏览器上(except IE)都支持伪类,currentStyle完全不支持伪类; b.前者使用getPropertyValue...获取样式,后者使用getAttribute获取样式; c.getPropertyValue中传入的变量不支持驼峰标示,多单词的css属性名只能以“-”连接,比如getPropertyValue(“background-color...”)合法,而getPropertyValue(“backgroundColor”)非法;IE有时候传入“-”连接符变量可以获取正确结果,有时候传入驼峰标识变量能获取正确结果,IE11下测试如下图 d....document.defaultView.getComputedStyle(dom,null); styleName = toHyphen(styleName); style = domStyles.getPropertyValue

88420

扫码

添加站长 进交流群

领取专属 10元无门槛券

手把手带您无忧上云

扫码加入开发者社群

相关资讯

热门标签

活动推荐

    运营活动

    活动名称
    广告关闭
    领券