V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Dive into HTML5
http://diveintohtml5.org/
Wilon
V2EX  ›  HTML

我今天研究 H5 页面有个问题想请教一下大家

  •  
  •   Wilon · 2016-03-22 17:49:42 +08:00 · 2968 次点击
    这是一个创建于 2929 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这个月才开始接触 HTMl 的,之前并不是写 web 端,今天研究了一下 Flexible 这个适配库,有个问题想请教一下大家,原文链接 https://github.com/amfe/article/issues/17 1.我打算通过 Sass 函数来计算对应的 rem 值,那么在这个文章的例子中

    @function px2em($px, $base-font-size: 16px)

    {

    @if (unitless($px)){

    @warn "Assuming #{$px} to be in pixels, attempting to convert it into pixels for you";

    @return px2em($px + 0px); // That may fail.

    } @else if (unit($px) == em) {

      @return $px;
    }
    @return ($px / $base-font-size) * 1em;
    

    }

    $base-font-size: 16px 貌似是设死的值,这个 16px 应该不能适配所有分辨率吧?这里是否能换成动态的 HTML 的 font-size ?

    2 条回复    2016-03-23 08:49:24 +08:00
    kamal
        1
    kamal  
       2016-03-22 18:04:57 +08:00

    只要跟这里对的上,可以改成其他值
    Wilon
        2
    Wilon  
    OP
       2016-03-23 08:49:24 +08:00
    @kamal 请问是什么意思?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2881 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 13:06 · PVG 21:06 · LAX 06:06 · JFK 09:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.