rem

// 设计稿宽度 : 750  ( 2倍图 )
// 缩放比例 : 100 ( 1rem === 100px ) (function (win, doc) { function setRootFontSize() { let docWidth = doc.documentElement.getBoundingClientRect().width doc.documentElement.style.fontSize = docWidth / 750 * 100 + 'px' } setRootFontSize() win.addEventListener('resize', setRootFontSize, !1) })(window, document)

 

posted @ 2018-12-29 12:59  大厨的笔记  阅读(110)  评论(0编辑  收藏  举报