Specifying a list of arbitrary children (no pattern) for nth-child and nth-of-type

前端 未结 2 1131
隐瞒了意图╮
隐瞒了意图╮ 2021-01-21 02:20

So I\'ve now read enough about various funky nth-child and nth-of-type patterns to have the seventh son of the seventh son fly a space-ship backwards t

2条回答
  •  醉酒成梦
    2021-01-21 02:40

    When CSS lacks a feature, Sass can help. You can try a formula like this one in Sass. It's not the most elegant solution, but perhaps you can improve on it.

    $children: 1,3,7,10;
    
    @each $child in $children {
      td:nth-child(#{$child}) {
        ...
      }
    }
    

提交回复
热议问题