【问题标题】:Media Queries not working in Internet Explorer ie6-ie8媒体查询在 Internet Explorer ie6-ie8 中不起作用
【发布时间】:2013-07-09 12:15:33
【问题描述】:

给出的代码是为 css 编写的,但在 IE(6-8) 中根本不工作

 @media screen and (max-width: 340px) {
.topmaindivleft{
width:100%;
margin:0px;
padding:0px;
height:auto;
float:left;
}
.topmaindivright{
width:100%;
margin:0px;
padding:0px;
height:auto;
float:left;
}
}

想知道一些代码以使其在 Ie6-8 中工作以制作响应式网站

【问题讨论】:

  • media queries internet explorer 的可能重复项
  • 如果这是第一次使用旧版浏览器并且您计划在未来做更多的事情,我建议您对哪些浏览器支持哪些功能以及它们之间的各种不一致进行一些研究。以caniuse.com 为例。

标签: css mpmediaquery


【解决方案1】:

这是因为媒体查询aren't supported in IE6 through to IE8

这个名为 Respond.js 的 polyfill 可能会对您有所帮助 - https://github.com/scottjehl/Respond

Respond.js - 用于最小/最大宽度 CSS3 的快速轻量级 polyfill 媒体查询(适用于 IE 6-8 等)

Here's a demo example.

【讨论】:

    【解决方案2】:

    Internet Explorer 6-8 不支持 CSS3 媒体查询。但是,有一种方法可以使用this JavaScript Polyfill 来模拟此类功能。 Polyfill 是使用 JavaScript 模拟不存在的功能的脚本。

    【讨论】:

      猜你喜欢
      • 2014-11-21
      • 2011-09-28
      • 2011-09-12
      • 1970-01-01
      • 2014-04-12
      • 1970-01-01
      • 2014-03-31
      • 2013-12-30
      相关资源
      最近更新 更多