REM单元在Android 2. *和Web View(直到Android 4.2)Native Browser中效果不佳

时间:2014-07-30 10:10:51

标签: android css css3 webview android-webview

这是我搜索了很长时间的错误,并没有找到任何关于它的错误。

在我正在进行的一个项目中,我开始使用REM装置。在每个有文字的元素中,我都给出了font-size&行高。

我不知道为什么但不知何故它不能理解REM的线高,并表现得没有REM。

html{
  font-size:1px;
}

.fu{
  font-size:20rem;
  line-height:24rem;/*old android, act like 24 without the REM Unit*/
}
/*normal browser - line-height 24*1 = 24px(root-font-size)
old android browser and webview line-height 24 * 20(font-size) = 480px*/

LIVE EXAMPLE(在桌面和旧机器人中观看)

我很高兴找到一种合适的解决方案,使我能够在行高中使用REM单位。

1 个答案:

答案 0 :(得分:0)

哟不能在android 2中使用rem line-height。*

解决方案:

使用多个字体大小

示例

html{
  font-size:1px;
}

.fu{
  font-size:20rem;
  line-height:1.2; /*1.2 equal to 24rem(in this case) and will resolve conflict in old android*/
}