用Sass遍历DYNAMIC第n个孩子

时间:2019-03-25 16:45:04

标签: css sass

@mixin会迭代所有第n个孩子,直到nth-child(4)

@mixin transition {
  @for $i from 1 through 4 {
    &:nth-child(#{$i}) {
      transition: all .2s #{$i * .1}s ease-in;
    }
  }
}

我一直在研究,找不到动态元素的解决方案。我需要nth-child(4)作为孩子的身长。

理论上是这样的:

@for $i from 1 through LENGTHOFCHILDREN

scss是否可能?

0 个答案:

没有答案