移动端一半会选用rem+flex布局的方式,下面是根据屏幕的宽度,动态的改变rem的参考值
var screenWidth;
var html = document.getElementsByTagName("html")[0];
if (window.innerWidth) {
screenWidth = window.innerWidth;
} else if ((document.body) && (document.body.clientWidth)) {
screenWidth = document.body.clientWidth;
}
html.style.fontSize = 100 * screenWidth / 750 + "px";