【问题标题】:Susy 2: How to remove "last" from nth-child on different breakpoint?Susy 2:如何在不同的断点从 nth-child 中删除“last”?
【发布时间】:2014-09-09 18:32:26
【问题描述】:

我正在使用 Susy 2,我有这个代码:

@include breakpoint($tab) {
  .l-region--sections {
    > .block {
      @include span(6 of 12);
      &:nth-child(2n) {
        @include last;
      }
    }
  }
}

@include breakpoint($desk) {
  .l-region--sections {
    > .block {
      @include span(4 of 16);
      &:last-child {
        @include last;
      }
    }
  }
}

问题是在桌面宽度上,“:nth-child(2n)”生效,我想完全删除它以支持“:last-child”。如何删除桌面的 ":nth-child(2n)" 样式?

【问题讨论】:

    标签: sass susy-compass


    【解决方案1】:

    看来答案就在这里:https://github.com/ericam/susy/issues/328,基本上是:

    @include breakpoint($tab) {
      .l-region--sections {
        > .block {
          @include span(6 of 12);
          &:nth-child(2n) {
            @include last;
          }
        }
      }
    }
    
    @include breakpoint($desk) {
      .l-region--sections {
        > .block {
          @include span(4 of 16);
          &:nth-child(2n) {
            @include span(4 of 16); // We are declaring span for this container here once more, just to override nth-child styles.
          }
          &:last-child {
            @include last;
          }
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-19
      • 2021-12-10
      • 1970-01-01
      • 1970-01-01
      • 2013-12-18
      • 2014-04-07
      • 2014-07-26
      • 2017-08-11
      相关资源
      最近更新 更多