android - android如何在浏览器中处理px vs dp?

标签 android mobile responsive-design density-independent-pixel

到目前为止,我发现的关于 Android 对 px 和 dp 的处理的所有内容似乎都与 native android 应用程序有关。

Android 如何处理在其 CSS 中使用 px 的网站?它会自动将其转换为合适的 dp 大小吗?

最佳答案

没有 AFAIK,但你可以 choose different CSS stylesheets, or different rules within a stylesheet, based upon density .这适用于 -webkit-device-pixel-ratio。或者,在 JavaScript 中,使用 window.devicePixelRatio 来确定密度。

关于android - android如何在浏览器中处理px vs dp?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13253969/

相关文章:

java - 应用程序关闭时如何获得android通知

linux - 在 "standard"Linux 系统上创建 OpenGL ES 2.0 上下文

html - 底部 div 重叠

html - Bootstrap 移动对齐与桌面对齐

css 媒体查询 : target mobile devices without specifying width, 像素比例等

android - 如何处理一个巨大的 JSON 数组?

android - Android Kotlin 中的 fragment 类型不匹配

android - 如何检查应用程序是否正在 Android TV 上运行

html - 替换图像以进行移动查看

android - 跨平台移动框架背后的逻辑