html - 浏览器正在将页面缩放到 125%

标签 html css opera

我有一个分辨率为 2560x1440 的显示器。我注意到我正在处理的网页已缩放到 125%。因此,如果边框设置为 4px - 它在屏幕上有 5px。它发生在 Opera、Chrome、Firefox 中,但不会发生在 Edge 中。

我假设它与 Windows 字体大小设置有关(在我的计算机上设置为 125%)。

如何使用 CSS 代码(或 head 中的 meta 标记?)或至少在浏览器设置中禁用此功能?

示例代码:

<html>
    <head>
        <!-- it does not change anything -->
        <!-- <meta name="viewport" content="width=device-width, initial-scale=1"> -->
    </head>
    <body>
        <div style="width: 10px; height: 10px; background-color: red;"></div>
    </body>
</html>

结果:

Browser scaling

最佳答案

终于找到答案了。

对于 Firefox: https://stackoverflow.com/a/24958483/6552578

Chrome : https://productforums.google.com/forum/#!topic/chrome/_jmREHlt3ZE

解决方案 - 需要像这样编辑指向 Chrome 的桌面链接:

"C:\Program Files\Google\Chrome\Application\chrome.exe"  /force-device-scale-factor=1

关于html - 浏览器正在将页面缩放到 125%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42359562/

相关文章:

css - 即使我有 3 个宽度设置为 100% 的容器 div,网站也无法正常显示

html - CSS样式表实现

selenium - OperaDriver 等待 Opera 启动器超时

user-interface - 有没有办法隐藏 Google Chrome 和 Opera 中显示的新 HTML5 spinbox 控件?

javascript - HTML5 Canvas : Same code outputs different results in different browsers

html - 如何设置多选的宽度?

html - 属性标题框仅更改宽度和高度 css

html - CSS :after is being pushed down by following elements

javascript - 无需单击或按任何键(复选框)即可添加事件类

javascript - 猫头鹰轮播图像幻灯片无法很好地调整大小