使用rem进行换算,根据移动端屏幕大小的变化,来动态的设置根元素的字体大小,rem就是根据根元素html的字体大小渲染的,
如果是375px的设计图,那么就将元素的尺寸px乘以2,在除以100就是该元素的rem值了
function mobileMatvhing(){
var html = document.getElementById(‘html‘);
var phoneWidth = document.documentElement.clientWidth;
html.style.fontSize = phoneWidth*100/750 + ‘px‘
}