Is it possible to apply the rules using some variable for nth-child, exclusively in CSS? Basically, I am trying to change the value for an indefinite number of elements depending on their position inside the element. Is there a way to use, for example, counter-increment or something on this base as a variable for a child position and the value of some property inside an element?
Some of these lines (which does not work):
.slider{
counter-reset:item;
}
.slide{
counter-increment:item;
color:red;
}
.slide:nth-child(counter(item)){
line-height:counter(item);
color:blue;
}
source
share