rem 是 css3 中新增加的一个尺寸(度量)单位,根节点的font-size决定了rem的尺寸,也就是说它是一个
html
,相对于
相对单位
。
html
//设置全局字体
var n = function() {
var n = document.documentElement.clientWidth;
if(n > 414) {
n = 414
}
document.documentElement.style.fontSize = n / 7.2 + "px";
};
window.onresize = function() {
n();
};
n();