rem设置根元素的字体大小

<script>
    var html = document.querySelector("html");
    html.style.fontSize = html.offsetWidth /7.5 + "px";
    addEventListener("resize",function(){
        html.style.fontSize = html.offsetWidth / 7.5 + "px";
    },false);
</script>

猜你喜欢

转载自blog.csdn.net/m0_37633370/article/details/77531360
今日推荐