- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我现在为此苦苦挣扎了一段时间。
我为客户做了一个响应式网站,但后来发现他的平板电脑 (Panasonic FZ-A1) 的设备像素比为 0.75,这意味着它说它有 1024x768 像素,但实际上显示较少。
虽然我觉得很难理解,但创建声称可以正确显示网页的设备有什么意义,而当它们显然无法做到这一点时,我正在努力寻找正确的方法来处理这个问题。
Here is the problem: 1px borders on elements randomly don't appear. Obviously, they don't appear on screen, because of the 0.75 pixel scale. My site is responsive, but the browser 'lies' about the screen size - it returns 1024x768, so media queries in CSS are working as if it would actually be that big.
header 中的元标记 <meta content="width=device-width, initial-scale=1.33" name="viewport"/>
不应该是答案,因为它不会影响浏览器对屏幕尺寸的描述,因此 CSS 响应将无法正常工作。
我在“设置”中找不到有关屏幕像素比的任何内容。
如有任何帮助,我们将不胜感激。甚至一些解释,为什么有人会生产具有 <1 屏幕像素比的设备。
更新:
在 native Android 浏览器中,“特殊”设置下有一个我刚刚发现的东西,它可以正常工作。它被称为“默认比例”,具有“远”、“正常”和“关闭”选项。选择“关闭”可以解决问题。但是话又说回来,Android 4.03 中的默认浏览器不支持某些 html5 功能,如果我们能找到更通用的解决方案,那就太好了。
最佳答案
我在使用完全相同的平板电脑时遇到了这个问题,这就是我最后所做的。
我曾尝试为低 dpi 屏幕使用媒体选择器,并执行 html { zoom: 120% } 这看起来很不错,但仍然缺少输入的几个像素。
最后我做了这个,效果很好,基本上它最终将视口(viewport)的宽度设置为 1024,这是那些硬垫的实际原始分辨率。
请注意,我仍然设置了 user-scaleable=no,因为我认为这有助于防止移动设备上的点击延迟。
<meta id="viewport" name="viewport" content="width=device-width, user-scalable=no">
<script type="text/javascript">
// Try and show the page nicer if we have a low dpi screen
if(window.devicePixelRatio < 1.0) {
var newWidth = Math.floor(screen.width * window.devicePixelRatio);
var viewportContent = "user-scalable=no, width=" + newWidth;
document.getElementById('viewport').setAttribute('content', viewportContent);
}
</script>
我只是希望我不必使用 javascript :(
关于android - Android : what to do with low devicePixelRatio devices: tablets, 智能手机等网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22308658/
java脚本中的 devicePixelRatio`在各种计算中。例如,我在除法中使用它作为分母。如果不检查该值是否为零,这是否安全?我认为是这样,但我想确定一下。 谢谢 最佳答案 无论是否可以,您都
我只是想知道与基于web-kit的浏览器和苹果设备相关的devicePixelRatio是否真的有用,或者它只是苹果的私有(private) Assets 。要知道,web-kit 引擎也是苹果公司的
我正在尝试在 typescript 文件中使用 window.devicePixelRatio 但这无法通过消息进行编译“属性‘devicePixelRatio’在‘窗口’类型的值上不存在” 是否有修
使用视网膜 Macbook Pro,可以插入外部显示器,然后在视网膜屏幕和其他正常 DPI 显示器之间拖动浏览器窗口。 这会导致 window.devicePixelRatio 动态变化吗?如果是这样
我一直在网上寻找浏览器对 window.devicePixelRatio 的支持,但运气不佳。 有谁知道哪些浏览器/设备支持这个? 最佳答案 根据 this博文:(自 2012 年起) window.
出于某种原因,任何小于 1 的像素比值在我的渲染算法中都不起作用。零值没有意义,但 0.5 有意义。 devicePixelRatio 是否可能返回 0 到 1 之间的值? 最佳答案 如果您将浏览器缩
window.devicePixelRatio 将返回 1 或 2,具体取决于我使用的是视网膜显示器还是标准显示器。如果我在两个显示器之间拖动窗口,这个属性就会改变。有什么方法可以在更改发生时触发监听
在我们的应用程序中,我们使用 Delphi 的 TWebBrowser 组件来显示 Web 内容。现在我们会遇到一个问题,即 Windows 是否缩放了显示器,例如 125% 的缩放比例。在这种情况下
有没有人找到一种可靠的方法来确定 Windows Phone 7.5 (Mango) 的设备像素比。 它基于 IE9。在基于 Webkit 的浏览器中,我们有 window.devicePixelRa
当浏览器打开我的网页时,是否可以使用 CSS 媒体查询将 devicePixelRatio 设置为 1? 我使用的屏幕分辨率为 1920x1080,显示比例为 125%(操作系统为 Windows 1
我对 devicePixelRatio 和 dppx 做了一些研究: deicePixelRatio:返回当前显示设备上一个物理像素的(垂直)尺寸与一个 CSS 像素的尺寸之比。 dppx:每‘px’
我正在尝试将图像设置为 phoneGap 应用程序屏幕的完整高度。目前,我正在使用以下代码来确定屏幕“尺寸”,并且正在使用 javascript 将图像分辨率设置为那些暗淡度。 $('.fullPag
我现在为此苦苦挣扎了一段时间。 我为客户做了一个响应式网站,但后来发现他的平板电脑 (Panasonic FZ-A1) 的设备像素比为 0.75,这意味着它说它有 1024x768 像素,但实际上显示
当我要在游戏中进入全屏模式时,我需要将canvas扩展到全屏。我使用 screen.width 和 screen.height 来检测屏幕尺寸。问题是,如果 Windows 10 中的屏幕比例设置未设
我想根据各种设备大小或 devicePixelRatio 值缩放我的 flutter 应用程序中的文本。我知道 flutter 应该根据 devicePixelRatio 值缩放文本,所以我以这种方式
我在 Darkroom.js GitHub 页面上问过这个问题,但它看起来并不特别活跃,所以我也在此处问过。总的来说,这是一个很棒的插件,但我在视网膜屏幕上进行了一些测试后遇到了问题。 在 devic
我正在使用 window.devicePixelRatio,它适用于 Android 和 Iphone,但不适用于 IE 10 Windows 移动设备。还有其他选择吗? 最佳答案 对于桌面和移动设备
我正在为企业开发网站。它不是任何想象中的 Web 应用程序,但我希望它在移动设备上看起来不错,而不是简单地缩放桌面版本。在对媒体查询和响应式/自适应设计方法进行了大量研究之后,我的要求是移动布局仅在用
我一直在测试 Three.js 的移动支持,并发现了 setSize 函数和多个 View 方面的一个怪癖。这是场景。 加载webgl_multiple_views时以我的 Nexus 7 (Andr
我正在尝试将 300dpi 图像绘制到 Canvas 对象,但在 Chrome 中它显示的质量很差。当我使用下面的代码时,它没有改善,但那是因为 devicePixelRatio 与 backingS
我是一名优秀的程序员,十分优秀!