Android设备的媒体查询

Android设备的媒体查询

本文介绍了Android设备的媒体查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站针对操作系统和iOS进行了优化,但通过browserstack.com对Android进行了测试,这让我对在我的媒体查询中定位Android设备感到困惑。

I have my site optimized for OS and iOS, but testing it for Android through browserstack.com has left me puzzled about targeting Android devices in my media queries.

这是我的查询适用于iOS设备:

Here is my query that works for iOS devices:

#using em based query after reading this article: http://blog.cloudfour.com/the-ems-have-it-proportional-media-queries-ftw/
@media only screen and (device-width: 20em)

我已经尝试过各种不同的查询(包括基于px的查询),但只是想要一个适用于所有/大多数手持Android设备。你有没有运气这个?感谢您的建议。

I have tried a variety of different queries (including px based queries), but just want one that will work for all / most handheld android devices. Have you had any luck with this? Thanks for your ideas.

推荐答案

如果您要使用媒体查询定位Android,我想您可以通过查询dpi来伪造。

if you want to target Android using media queries, I think you can fake it by querying dpi.

@media screen and (min-resolution: 192dpi) { … }

这篇关于Android设备的媒体查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:35