javascript - 流体布局在 Internet Explorer 7 和 8 中不起作用

标签 javascript jquery html css internet-explorer

我正在负责任地使用 CSS 处理 float 框,我的目标是让它在 Internet Explorer 7 和 8 中工作。我可以在 Jquery 中实现吗?

如果有人可以提供帮助,这将是一个巨大的帮助!!!

这是我的 fiddle 。请更新:)

http://jsfiddle.net/ZuJW2/

/* =============================================================================
BOXS RESPONSIVE
========================================================================== */

#examples {
  width: 100%;
  max-width: 970px;
  margin: 0 auto;
}
#examples ul {
  width: 100%;
  overflow: hidden;
  *zoom: 1;
}
#examples ul li {
  float: left;
  margin-right: -100%;
  width: 100%;
}

#examples ul li a:hover {
  text-decoration: none;
}

#examples ul li span {
  font-size: 16px;
  line-height: 22px;
  display: block;
  padding-bottom: 30px;
}
#examples ul li img {
  width: 100%;
}
#examples ul li:nth-child(1n+1) {
  margin-left: 0%;
  margin-bottom: 3.85%;
  clear: both;
  overflow: hidden;
  *zoom: 1;
}

@media screen and (min-width: 460px) {
  #examples ul li {
    float: left;
    margin-right: -100%;
    width: 48.08%;
  }
  #examples ul li span {
    padding-bottom: 10px;
  }
  #examples ul li:nth-child(2n+1) {
    margin-left: 0%;
    margin-bottom: 3.85%;
    clear: both;
    overflow: hidden;
    *zoom: 1;
  }
  #examples ul li:nth-child(2n+2) {
    margin-left: 51.93%;
    margin-bottom: 3.85%;
    clear: none;
  }
}
@media screen and (min-width: 700px) {
  #examples ul li span {
    padding-bottom: 10px;
  }
}
@media screen and (min-width: 900px) {
  #examples ul li {
    float: left;
    margin-right: -100%;
    width: 22.11%;
  }
  #examples ul li span {
    padding-bottom: 0px;
  }
  #examples ul li:nth-child(4n+1) {
    margin-left: 0%;
    margin-bottom: 3.85%;
    clear: both;
    overflow: hidden;
    *zoom: 1;
  }
  #examples ul li:nth-child(4n+2) {
    margin-left: 25.96%;
    margin-bottom: 3.85%;
    clear: none;
  }
  #examples ul li:nth-child(4n+3) {
    margin-left: 51.93%;
    margin-bottom: 3.85%;
    clear: none;
  }
  #examples ul li:nth-child(4n+4) {
    margin-left: 77.89%;
    margin-bottom: 3.85%;
    clear: none;
  }
}

最佳答案

使用Modernizr处理 IE7 和 8。

关于javascript - 流体布局在 Internet Explorer 7 和 8 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19633402/

相关文章:

javascript - 将变量传递到主干模板时,如何在模板中引用它?

php - 单击清除或隐藏具有相同类名的标签

javascript - 用于执行多项任务的书签

jquery 输入删除第一个字母,如果它 = x

HTML5 日期输入宽度

java - 帮助在 Android 中获取 HTML 文件

javascript - Javascript!==给出的结果与===相反

javascript - 有没有一种方法可以简化 React.js 中状态中的一长串代码

javascript - 如何在全局中设置javascript函数?

jquery - -webkit-线性渐变 jquery 和 var