rem自适应布局

(function() {
        var html = document.querySelector('html')
        html.style.fontSize = window.innerWidth / 7.5 + 'px'
        //window.onresize 当页面调整大小时触发
        window.onresize = function(e) {
            html.style.fontSize = window.innerWidth / 7.5 + 'px'
        }})()

 

posted @ 2019-06-04 16:12  就这样子吧  阅读(148)  评论(0编辑  收藏  举报