Wilon
V2EX  ›  HTML

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

  •  
  •   Wilon · Mar 22, 2016 · 3758 views
    This topic created in 3736 days ago, the information mentioned may be changed or developed.

    这个月才开始接触 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 replies    2016-03-23 08:49:24 +08:00
    kamal
        1
    kamal  
       Mar 22, 2016

    只要跟这里对的上,可以改成其他值
    Wilon
        2
    Wilon  
    OP
       Mar 23, 2016
    @kamal 请问是什么意思?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2792 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 12:06 · PVG 20:06 · LAX 05:06 · JFK 08:06
    ♥ Do have faith in what you're doing.