wap rem 根元素字体设置

设计图 750*1334,根元素字体大小100px

(function (doc, win) {
    var docEl = doc.documentElement,
        resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
        recalc = function () {
            var clientWidth = docEl.clientWidth;
            if (!clientWidth) return;
               docEl.style.fontSize =  (clientWidth/7.5) + 'px'; 
               if(clientWidth>1024){
            	   docEl.style.fontSize =  '100px'; 
               }
        };
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
    recalc();//doc.addEventListener('DOMContentLoaded', recalc, false); 
})(document, window);
css使用1rem =100px换算 

你可能感兴趣的:(wap rem 根元素字体设置)