xingo

Android Chrome 上的 line-height 的一个奇怪的坑

  •  
  •   xingo · Oct 24, 2016 · 3439 views
    This topic created in 3565 days ago, the information mentioned may be changed or developed.

    最近做的一个页面,活不多所以对细节稍微追究了点,碰到个奇怪的问题,上图

    上图(左 iphone 6/ios 10.0 ,右 Nexus 6p/Android 7.0/Chrome 53.0 )

    ios/Android 对比

    (上边标题没有划出来的地方貌似是 ios -webkit-box 的问题)

    几乎所有用 px 单位设置过 line-height 的地方, android 都会不由自主的字会向上偏移大概 2px 左右

    然而偶尔调试一下,发现设置成line-height: normal;便全部都正常了

    上图(左右均 Android ,使用 chrome inspect ) line-height 对比 1 line-height 对比 2

    想问问为什么会这样_(:з」∠)_

    3 replies    2016-10-25 10:46:02 +08:00
    xxxyyy
        1
    xxxyyy  
       Oct 24, 2016 via Android
    设成 normal 后计算出来的 line-height 是多少?
    xingo
        2
    xingo  
    OP
       Oct 25, 2016
    @xxxyyy 设置成 normal computed 里边就是 normal 啊,但我倒是有注意到 因为我手机语言是日文,默认字体是日文字体,会不会是这个的锅

    ![normal.png]( https://ooo.0o0.ooo/2016/10/25/580eb1207efbf.png)
    ![19px.png]( https://ooo.0o0.ooo/2016/10/25/580eb120a01d0.png)
    xingo
        3
    xingo  
    OP
       Oct 25, 2016
    用另一台 Nexus 6 发现没有这样的问题,看来是日文的中文字体的问题了_(:з」∠)_
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3481 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 04:54 · PVG 12:54 · LAX 21:54 · JFK 00:54
    ♥ Do have faith in what you're doing.