Selecting with a Formula
We could also select elements using a formula, an + b
.
a is the cycle size
n is the counter which starts from 0
b is the offset value
.box:nth-child(3n+5) {
font-size: 65px;
}
(3x0)+5=5 <5th element> (3x1)+5=8 <8th element> (3x2)+5=11 <11th element>
Examples
