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  工作笔记_chen  阅读(118)  评论(0)    收藏  举报