CSS 仅适用于媒体查询中的 IE 11 屏幕尺寸
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45973976/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apply only to IE 11 within media query for screen size
提问by Luke
I currently have following width specific media query.
我目前有以下特定于宽度的媒体查询。
@media only screen and (max-width: 1920px) {
.toggleMultiSelect .filter {
width: 566px;
}
}
But the width for '.toggleMultiSelect .filter' changes in IE from Chrome/Firefox. So basically need to apply different width for the same css class in 1920px for IE. From the Stackoverflow search I found that IE specific behavior can be achieved like below.
但是“ .toggleMultiSelect .filter”的宽度在 Chrome/Firefox 中的 IE 中发生了变化。所以基本上需要在 1920px 为 IE 为相同的 css 类应用不同的宽度。从 Stackoverflow 搜索中,我发现可以像下面这样实现 IE 特定的行为。
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.toggleMultiSelect .filter {
width: 575px;
}
}
So now I need to achieve both resolution and css class. 575pxwidth only should apply to IE and Chrome or firefox should get 566px.
所以现在我需要同时实现分辨率和 css 类。575px宽度仅适用于 IE 和 Chrome 或 firefox 应获得566px。
Thanks in advance for any help.
在此先感谢您的帮助。
回答by Shahil M
Use the below css inside the media query
在媒体查询中使用以下 css
IE 10 and above
IE 10 及以上
_:-ms-lang(x), .ie10up {
property:value;
}
IE 11 and above
IE 11 及以上
_:-ms-fullscreen, :root .CLASS_NAME {
property:value;
}
回答by weBBer
Did you try combining them like this -
你有没有尝试像这样组合它们 -
@media only screen and (max-width: 1920px) {
.toggleMultiSelect .filter {
width: 566px;
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.toggleMultiSelect .filter {
width: 575px;
}
}
}
This may work am Notsure, am using Mac
so no way to test, But I think this will work for you. Hope this was helpful.
这可能工作时不肯定的是,现在用Mac
所以没办法测试,但我认为这会为你工作。希望这是有帮助的。