Counter (element) as a variable for nth-child css

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;
}
+4
source share
1 answer

, .slide: nth-child "counter-increment" reset. http://www.w3schools.com/cssref/pr_gen_counter-increment.asp"

0

Source: https://habr.com/ru/post/1548338/


All Articles