rem布局

97 阅读1分钟

!(() => { const root = document.querySelector(':root') || document.documentElement; const updateRootFontSize = () => { const width = ((root.clientWidth * (16 / 750)) / 16) * 10; root.style.fontSize = ${width}px; };

window.addEventListener('resize', updateRootFontSize, false); updateRootFontSize(); })();