device-aspect-ratio (media query) not working for Droid 2
Asked Answered
A

2

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.

Alkaloid answered 1/11, 2011 at 20:38 Comment(0)
M
1

I had the same problem same times ago. I solved it by dynamic css resolution based on js/php width resolution. In few words, taken width resolution, the script resized all the element by the % based on original size->target size. For IE same problem solved by ms filter. Worked by all device becasue stylesheet was dynamically calculated.

Musculature answered 19/2, 2012 at 15:56 Comment(0)
S
0

What about just using max-device-width and targeting the Droid 2's 240dpi screen with either resolution:240dpi or -webkit-device-pixel-ratio:1.5? Unfortunately, I don't have an Android device to test this, so I cannot speak authoritatively on it.

Refs:

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/

Sudan answered 7/11, 2011 at 23:27 Comment(1)
That is certainly an option, but knowing an aspect ratio allows for variable viewport scaling by groups of devices that may not share the same resolution but have the same aspect ratio. Regardless, I'd like to know if aspect-ratio is just not supported in Android or not supported properly on specific versions, etc.Alkaloid

© 2022 - 2024 — McMap. All rights reserved.