`(function (doc, win) {
var docEl = doc.documentElement,
resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
recalc = function () {
var clientWidth = docEl.clientWidth;
// alert(clientWidth)
//var foot = document.getElementById("foot");
if (!clientWidth) return;
if (clientWidth<640){
docEl.style.fontSize = 100 * (clientWidth / 640) + "px";
console.log(100 * (clientWidth / 640) + "px");
}else{
docEl.style.fontSize = "625%";
}
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
`
初始的html 设置为16px;
在写的时候,实际测量的尺寸除以100就是rem了