美文网首页
移动端 rem 解决

移动端 rem 解决

作者: MuLuo丶 | 来源:发表于2016-05-31 14:02 被阅读0次

例子:

rem:相对长度单位。相对于根元素(即html元素)font-size计算值的倍数

! function (a) {
    var j, b = a.document,
        c = b.documentElement,
        d = a.orientation || 0,
        e = 640,
        f = 9 / 16,
        g = 100,
        h = a.devicePixelRatio,
        i = h ? 1 / h : 1;
    b.write('<meta name="viewport" content="initial-scale=' + i + ",maximum-scale=" + i + ",minimum-scale=" + i +
        ',user-scalable=0">'), j = c.getBoundingClientRect().width, 90 == Math.abs(d) && (j *= f), c.style.fontSize = j /
        h * g / (e / h) + "px"
}(window);

原文连接:https://github.com/ximan/flexible.rem

相关文章

网友评论

      本文标题:移动端 rem 解决

      本文链接:https://www.haomeiwen.com/subject/gmmfdttx.html