rem+js响应式布局的设置

直接调用代码即可,不过不同屏幕宽度要求会不同,相应修改一下就ok了

//            rem响应式布局
        (function(){
          var html=document.querySelector('html') 
          html.style.fontSize=window.innerWidth/7.5+'px'
          window.onresize=function(e){
            html.style.fontSize=window.innerWidth/7.5+'px'
          }
            })()

//方式二

document.documentElement.style.fontSize = document.documentElement.clientWidth / 375*100 + 'px';


//方式二方式三

(function(){

var html=document.querySelector('html')

html.style.fontSize=window.innerWidth/375*100+'px'
window.onresize=function(e){
html.style.fontSize=window.innerWidth/375*100+'px'
}
})()