禁用Internet Explorer 11自动缩放缩放到视口宽度-IE11 [英] Disable Internet Explorer 11 Auto Scaling Zoom to Viewport Width - IE11
问题描述
有什么方法可以防止Internet Explorer 11中的自动缩放到视口宽度"(又称自动缩放)功能吗?
Is there any way to prevent the "auto zoom to viewport width" (a.k.a. automatic scaling) feature in Internet Explorer 11?
我想强制浏览器遵循我的max-width
规则,并阻止它将页面内容自动缩放到视口的整个宽度.
I want to force the browser to follow my max-width
rule and prevent it from auto-scaling the page contents to the full width of the viewport.
我在Surface Pro 2的IE11中以桌面"和地铁"模式都看到了这个问题.在此处进行讨论,并且可能与外部显示器有关,尽管我在连接或不连接外部显示器的情况下都遇到了这种情况,并且在Surface监视器和外部显示器上都进行了缩放.
I'm seeing the issue in IE11 on Surface Pro 2 in both "desktop" and "metro" modes. The issue is discussed here and may be related to external displays, although I'm experiencing it with or without an external display attached, and the zooming occurs on both the Surface monitor and on external displays.
页面 Microsoft文档中的建议您可以使用此CSS规则选择退出自动缩放":
This page in the Microsoft docs suggests you can opt out of "automatic scaling" using this CSS rule:
@media screen {
@-ms-viewport {
width: device-width;
}
}
但这对我没有用;它所做的一切都会默认隐藏垂直滚动条.页面仍会缩放到视口的整个宽度,而忽略CSS中设置的任何max-width
值.
But that's not working for me; all it does it hide the vertical scrollbar by default. Pages still zoom to the full width of the viewport, ignoring any max-width
values set in the CSS.
文档:
默认情况下,新的Internet Explorer 当窗口变窄时,Windows UI自动缩放内容 大于1024像素.这主要包括捕捉状态和 纵向模式.
By default, the Internet Explorer in the new Windows UI automatically scales content when the window is narrower than 1024 pixels. This primarily includes the snapped state and portrait mode.
但是,如果没有自动缩放 需要或期望时,可以使用device-width关键字.这个关键词 表示页面经过优化可以正常工作,无论 设备的宽度.
However, in cases where this automatic scaling is not needed or desired, the device-width keyword can be used. This keyword signifies that the page is optimized to work well regardless of the width of the device.
我所遇到的实际上与文档所说的相反.当视口宽大于1024像素时,内容将自动缩放.
What I'm experiencing is actually the opposite of what the docs say. When the viewport is wider than 1024 pixels, content is automatically scaled.
-
这是我为meta视口标签设置的内容:
Here's what I have set for my meta viewport tag:
<meta name="viewport" content="width=device-width,initial-scale=1">
推荐答案
media screen
可能不会由Surface触发.您应该从媒体查询中将其删除,或者使用only
调整查询.
media screen
may not be triggered by the Surface . You should either remove it from te media query or adjust the query with only
.
@media only screen {
@-ms-viewport { width: device-width; }
}
进一步:
-
@-ms-viewport
规则 - 媒体查询
@-ms-viewport
rule- Media Queries
Further:
这篇关于禁用Internet Explorer 11自动缩放缩放到视口宽度-IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!