C
C
caof192020-04-14 19:17:28
stylus
caof19, 2020-04-14 19:17:28

How to create a loop for nth-child?

Hello, I work in the stylus preprocessor. The task is to make the following code, through a loop, I don’t understand what’s wrong
Code in css:

.example .example__item:nth-child(1)
  grid-area: item1
.example .example__item:nth-child(2)
  grid-area: item2
.example .example__item:nth-child(3)
  grid-area: item3

On stylus:
.example
  for row,index in 1 2 3
    .example__item:nth-child({row})
      grid-area: item{row}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question