用于字体大小和容器的宽高字体和宽高设为rem就可以了
var html = document.documentElement;
??? function fonts(){
??????? var hW = html.offsetWidth;
??????? var hS = hW / 50;
??????? html.style.fontSize = hS + "px";
???}
//浏览器窗口改变自动刷新
???$(window).resize(function () {
??????? location.reload();
??????? fonts();直接调用
???})
js实现字体和容器宽高随窗口改变
原文地址:https://www.cnblogs.com/lan-f/p/9826126.html