devicepixelratio不匹配期望

发布于 2025-01-17 10:04:00 字数 519 浏览 4 评论 0原文

我的监视器具有本地分辨率3072宽度和1920年物理像素高度的监测。但是,我使用缩放版本(1792 x 1120)。我创建了一个简单的网站,该站点包含高度的DIV:1120px;。在没有任何浏览器标头的情况下以全屏模式打开站点,恰好100%覆盖了我的屏幕。 AS mdn> mdn 州:

窗口接口的设备pixelratio返回的比率 物理像素分辨率分辨率为CSS像素的分辨率 当前显示设备。

因此,我查看了DevTools控制台,我看到了对我的窗口。DevicePixelRatio= 2。 现在,我想知道我的设备pixelratio是否不应该等于1920/1120而不是2?如果真的是2,那么我的本地高度分辨率应该是2240个物理像素。

I have monitor with native resolution 3072 width and 1920 height of physical pixels. However I use scaled version (1792 x 1120). I have created a simple site containing div styled with height: 1120px;. Opening site in full screen mode without any browser's headers covers my screen in exactly 100%. As MDN states:

The devicePixelRatio of Window interface returns the ratio of the
resolution in physical pixels to the resolution in CSS pixels for the
current display device.

So I looked at devTools console and I see that for me window.devicePixelRatio = 2.
And now I wonder if my devicePixelRatio shouldn't be equal 1920/1120 instead of 2? If it really is 2 then my native height resolution should be 2240 physical pixels.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文