Is it possible to increment the margin-top
of an element based on its index using a counter()
? For example:
div {
margin-top: calc(counter(myCounter) * 10px);
}
I couldn't find any information on whether this is achievable or not. Since counters in CSS are essentially variables, is there a way to use a CSS counter number as the value of a property?
EDIT
The potential duplicate question (Set margin (indent) based on counter value in CSS) does not clarify if such manipulation with counters is possible and why. It only offers an alternative approach.