【问题标题】:Internet Explorer 10+ media queries and responsive break pointsInternet Explorer 10+ 媒体查询和响应式断点
【发布时间】:2018-07-22 07:33:49
【问题描述】:

我正在尝试将 IE10+ 特定媒体查询与最大宽度分页断点结合起来。

我很确定它们可以组合,但不知道该怎么做。

这是原始的 IE10+ 唯一的 css 媒体查询:

@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
   /* IE10+ CSS styles go here */
   }

这是我将它们组合起来的微弱尝试:

@media (-ms-high-contrast: none), (-ms-high-contrast: active), only screen and (max-width: 950px) {
    /* IE10+ CSS styles go here */ 
    }

这里只有 IE 的代码可以正常工作,但是“max-width”根本不起作用。

感谢您的帮助!

【问题讨论】:

  • 你是说它可以在其他浏览器中使用吗?告诉我您尝试通过示例网站实现的效果
  • 您最近删除的问题is being discussed on Meta。欢迎您发表评论或不发表评论(但是,不用说,如果您这样做,请保持建设性 - 谢谢)。

标签: css internet-explorer responsive-design media-queries


【解决方案1】:

如果你这样做,它会起作用:重复媒体查询选择器的所有部分。

.For.IE.only {
  display: none
}

@media all and (-ms-high-contrast: active) and (max-width: 950px),
       all and (-ms-high-contrast: none) and (max-width: 950px) {
  .For.IE.only {
    display: block
  }
}
<div class="For IE only">
  This is for IE only, and only on narrow screens
</div>
<div>
  This is for all browsers
</div>

免责声明:我这里没有 IE10,只有 IE11,但我有理由确定它也可以在 IE10 中使用。

【讨论】:

  • 谢谢李斯特先生。我会试一试并报告。
  • 对不起,时间占了我的便宜
猜你喜欢
  • 2011-09-12
  • 2018-08-28
  • 2012-05-24
  • 2014-04-12
  • 2013-07-02
  • 2012-01-23
相关资源
最近更新 更多