rem动态适配问题

<!-- rem实现适配 -->
<script type="text/javascript">
// 页面打开 立即计算
document.querySelector('html').style.fontSize = window.screen.width / 20 + 'px';
// 尺寸更改也会重新计算
// 这里 写这个事件的目的是 是为了 让我们在 桌面端测试时 可以自动计算 移动端
window.onresize = function () {
document.querySelector('html').style.fontSize = window.screen.width / 20 + 'px';
}
</script>

  

posted @ 2017-08-17 20:57  无为-前端开发  阅读(220)  评论(0编辑  收藏  举报