Susy 2:如何删除" last"来自nth-child的不同断点?

时间:2014-09-09 09:33:52

标签: sass susy-compass

我正在使用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)”样式?

1 个答案:

答案 0 :(得分:2)

答案就在这里: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;
      }
    }
  }
}