function rem(pwidth){ // pwidth是设计稿宽度
const documentWidth=document.documentElement.clientWidth
const bodyWidth=document.body.clientWidth
const W=documentWidth || bodyWidth
// 获取html 或者body的宽度
document.documentElement.style.fontSize=pwidth/W*100+'px'
// pwidth/W 把pWidth分成W份的宽度 或者说浏览器1/W(也就是1px)的宽度在设计稿对应的像素值是pwidth/W
}
window.onresize=function(){
rem(750)
}
rem(750)