为什么安卓4.0与PhoneGap的忽略EM CSS大小? [英] Why does Android 4 with Phonegap ignore css sizes in em?

查看:134
本文介绍了为什么安卓4.0与PhoneGap的忽略EM CSS大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用EM是不是PX设置HTML容器和图像尺寸在我的PhoneGap的应用程序。

I am using em's instead of px to set sizes of HTML containers and images in my Phonegap app.

示例:

<div id="outer">
 <div id="inner">
  Hello
 </div>
</div>

<style>
#outer{font-size:0.5px}
#inner{font-size:2em;width:2em}
</style>

使用上面的样式,#inner应具有1像素的宽度和字体也应该有1像素大小

Using the style above, #inner should have a width of 1px and font should also have 1px size.

这行之有效的:


  • 所有的Andr​​oid浏览器

  • iPhone(浏览器和本地的PhoneGap构建)

  • 与PhoneGap的本机Android 2.x的应用

BUT

它不与PhoneGap的一个原生的Andr​​oid 4.x版应用程序(在模拟器和实际设备测试)工作。

it doesn't work for a native Android 4.x app with Phonegap (tested on Emulator and real devices).

有关某些原因字体大小#inner似乎是正确的降低为1px BUT 容器本身忽略父字体大小。

For some reasons font-size in #inner seems to be correctly reduced to 1px BUT the container itself ignores the parent font-size.

这是怎么回事?

推荐答案

发现的问题。

Android的4轮了字体大小值小于8多达8个。

Android 4 rounds up font size values less than 8 up to 8.

所以,如果你使用字体大小:0.5px 它会更改字体大小为8像素

So, if you use font-size:0.5px it'll change the font size to 8px.

这篇关于为什么安卓4.0与PhoneGap的忽略EM CSS大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆