2017年8月11日

getComputedStyle方法获取元素CSS值

摘要: javascript的style属性只能获取内联样式,对于外部样式和嵌入式样式需要用currentStyle属性。但是,currentStyle在FIrefox和Chrome下不支持,需要用getComputedStyle 1、getComputedStyle是? getComputedStyle是 阅读全文

posted @ 2017-08-11 17:26 ranyonsue 阅读(458) 评论(0) 推荐(0) 编辑

js获得当前元素的样式

摘要: 利用currentStyle()和ComputedStyle() 1 通常用法: balance为类名 window.getComputedStyle(document.querySelector(".balance"), null).backgroundColor; window.getCompu 阅读全文

posted @ 2017-08-11 15:59 ranyonsue 阅读(1169) 评论(0) 推荐(0) 编辑

移动端 Retina屏border实现0.5px

摘要: 首先来看一下造成Retina边框变粗的原因 其实这个原因很简单,因为css中的1px并不等于移动设备的1px,这些由于不同的手机有不同的像素密度。在window对象中有一个devicePixelRatio属性,他可以反应css中的像素与设备的像素比。 devicePixelRatio的官方的定义为: 阅读全文

posted @ 2017-08-11 13:24 ranyonsue 阅读(1026) 评论(0) 推荐(0) 编辑

导航