以最小1024尺寸为例:
function rem() { var htmlEle = document.documentElement; var winWidth = htmlEle.clientWidth || document.body.clientWidth; var width = winWidth <= 1024 ? 1024 : winWidth; htmlEle.style.fontSize = Math.ceil(100 * (width / 1920)) + 'px'; htmlEle.style.height = htmlEle.clientHeight + 'px'; htmlEle.style.minWidth = 1024 + 'px'; }; rem(); window.onresize = function() { rem(); }