css - nth-of-type 在 IE 9 中不起作用

标签 css internet-explorer css-selectors

我无法让第 nth-of-type 在 IE 9 中工作 -> 目前我的 ccs 代码在 IE 8 上工作。任何人都可以提出解决方法吗?在台式机上我想要 4 cols 和移动到 1 col

网址 http://aboriginalart.org.au/aaaa/artist-members/

.author-block {
  /*width: 48%;*/
  width: 23%;
  /*margin-right: 3.8%;*/
  margin-right: 9px;
  float: left;
  /*margin-bottom: 1.5em;*/
  /*font-size: 14px !important;*/
}
/* 2,4,6 */
.author-block1:nth-of-type(4n) {
  margin-right: 0;
}
/* 1,3,5 */
.author-block1:nth-of-type(4n+1) {
  clear: both;
}

/* Smartphones (landscape) ----------- */
@media only screen and (min-width : 320px) {
  .author-block {
    width: 100%;
    margin-right: 10px;
    float: left;
  }
  /* 2,4,6 */
  .author-block1:nth-of-type(1n) {
    margin-right: 0;
  }
  /* 1,3,5 */
  .author-block1:nth-of-type(1n+1) {
    clear: both;
  }

/* Desktops and laptops ----------- */
@media only screen  and (min-width : 480px) {
  .author-block {
    width: 48%;
    margin-right: 10px;
    float: left;
  }
  /* 2,4,6 */
  .author-block1:nth-of-type(2n) {
    margin-right: 0;
  }
  /* 1,3,5 */
  .author-block1:nth-of-type(2n+1) {
    clear: both;
  }

/* Desktops and laptops ----------- */
@media only screen  and (min-width : 768px) {
  .author-block {
    width: 30%;
    margin-right: 10px;
    float: left;
  }
  /* 2,4,6 */
  .author-block1:nth-of-type(3n) {
    margin-right: 0;
  }
  /* 1,3,5 */
  .author-block1:nth-of-type(3n+1) {
    clear: both;
  }

/* Desktops and laptops ----------- */
@media only screen  and (min-width : 1224px) {
  .author-block {
    width: 24%;
    margin-right: 10px;
    float: left;
  }
  /* 2,4,6 */
  .author-block1:nth-of-type(4n) {
    margin-right: 0;
  }
  /* 1,3,5 */
  .author-block1:nth-of-type(4n+1) {
    clear: both;
  }

最佳答案

除 IE 9-> IE 8 作品外的欢呼声(我已经为 :nth-of-type 更改了 .author-block。然后进行了所有媒体查询 nth-of-type(4n) 而不是组合查询 nth-of-type(1n) nth-of-type(2n)

     .author-block {
      /*width: 48%;*/
      width: 23%;
      /*margin-right: 3.8%;*/
      margin-right: 9px;
      float: left;
      /*margin-bottom: 1.5em;*/
      /*font-size: 14px !important;*/
    }
    /* 2,4,6 */

    .author-block:nth-of-type(4n) {
      margin-right: 0;
    }
    /* 1,3,5 */

    .author-block:nth-of-type(4n+1) {
      clear: both;
    }
    /* Smartphones (landscape) ----------- */

    @media only screen and (min-width: 320px) {
      .author-block {
        width: 100%;
        margin-right: 10px;
        float: left;
      }
      /* 2,4,6 */
      .author-block:nth-of-type(4n) {
        margin-right: 0;
      }
      /* 1,3,5 */
      .author-block:nth-of-type(4n+1) {
        clear: both;
      }
      /* Desktops and laptops ----------- */
      @media only screen and (min-width: 480px) {
        .author-block {
          width: 48%;
          margin-right: 10px;
          float: left;
        }
        /* 2,4,6 */
        .author-block:nth-of-type(4n) {
          margin-right: 0;
        }
        /* 1,3,5 */
        .author-block:nth-of-type(4n+1) {
          clear: both;
        }
        /* Desktops and laptops ----------- */
        @media only screen and (min-width: 768px) {
          .author-block {
            width: 30%;
            margin-right: 10px;
            float: left;
          }
          /* 2,4,6 */
          .author-block:nth-of-type(4n) {
            margin-right: 0;
          }
          /* 1,3,5 */
          .author-block:nth-of-type(4n+1) {
            clear: both;
          }
          /* Desktops and laptops ----------- */
          @media only screen and (min-width: 1224px) {
            .author-block {
              width: 24%;
              margin-right: 10px;
              float: left;
            }

关于css - nth-of-type 在 IE 9 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37738259/

相关文章:

CSS到达嵌套div

css - 如何覆盖所有元素中的推特 Bootstrap 颜色?

javascript - 不同浏览器的 HTML

css - 如何通过其部分类名 CSS 获取元素

internet-explorer - AutoHotKey 如何从 Internet Explore 中的网页获取文本

jquery - IE JQuery 就绪功能不起作用

css - 我应该在 <main> 标签上添加一个类吗?

javascript - 当我按下产生效果的按钮时,我怎样才能使下滑效果不让我的网页回到顶部?

css - Bootstrap 4 面包屑中断标签栏

html - 一键二动(换图)