7

I have some content that needs varying styles ultimately based on aspect ratio (basically it's targeted at one platform but as a "would-be-nice" I want to make the content at least appear correct on other platforms). I'm finding that the Droid 2 (Android 2.2 stock) is not responding to any of these queries:

only all and (device-aspect-ratio: 854/480)
only all and (device-aspect-ratio: 480/854)
only all and (aspect-ratio: 854/480)
only all and (aspect-ratio: 480/854)

Does the phone or the OS not support the aspect-ratio query? Is the Droid 2 full of sad? The aspect ratio tests work perfectly for iPhone 3GS/4/4S and iPad so far for me. Alternatively, what would someone suggest for handling Droid 2 / Nexus resolutions after my iOS aspect ratio tests if they don't actually support device aspect ratio.

I'm trying to shy away from using max-width because some Android devices in landscape are wider than an iPad in portrait and I was getting collisions where a device would incorrectly identify as an iPad based on a set width. Any insight would be appreciated.

4

2 回答 2

1

我以前也有同样的问题。我通过基于 js/php 宽度分辨率的动态 css 分辨率解决了它。简而言之,采用宽度分辨率,脚本根据原始大小-> 目标大小将所有元素的大小调整为 %。对于 IE,ms 过滤器解决了同样的问题。由所有设备工作,因为样式表是动态计算的。

于 2012-02-19T15:56:08.743 回答
0

仅使用max-device-width或定位 Droid 2 的 240dpi 屏幕怎么样resolution:240dpi-webkit-device-pixel-ratio:1.5不幸的是,我没有安卓设备来测试这个,所以我不能权威地谈论它。

参考:

http://www.fiveminutes.eu/targeting-hight-screen-densities-with-css-media-queries/

http://designbycode.tumblr.com/post/1127120282/pixel-perfect-android-web-ui

http://developer.motorola.com/products/droid2/

于 2011-11-07T23:27:16.473 回答