<script>
(function anonymous() {
// 声明一个函数,并直接的执行
function computed() {
let HTML = document.documentElement, winW = HTML.clientWidth, desW = 750;
if (winW > desW) {
HTML.style.fontSize = "100px";
return;
}
HTML.style.fontSize = winW / 750 * 100 + "px";
}
computed();
window.addEventListener('resize', computed, false);
})();
</script>
转载于:https://www.cnblogs.com/leigepython/p/9468703.html
本文介绍了一种使用JavaScript实现的自适应网页布局方法,通过监听窗口大小变化调整页面字体大小,确保在不同设备上都能获得良好的阅读体验。
204

被折叠的 条评论
为什么被折叠?



