// .js
(function(doc,win){
let docEL = doc.documentElement
let resize = 'orientationChange' in window?'orientationChange':'resize'
docEL.style.fontSize = 20*docEL.clientWidth/640+'px'
let resizeRem = function(){
docEL.style.fontSize = 20*docEL.clientWidth/640+'px'
}
win.addEventListener(resize,resizeRem,false)
})(document,window)
在项目中使用rem自适应单位
最新推荐文章于 2022-07-28 20:29:42 发布