It's possible to select a range of element each 5 elements? What i expect:
<ul>
<li>Test</li>
<li>Test</li> //this
<li>Test</li> //this
<li>Test</li> //this
<li>Test</li>
<li>Test</li>
<li>Test</li> //this
<li>Test</li> //this
<li>Test</li> //this
<li>Test</li>
</ul>
From 2 to 4, from 7 to 9, etc.
Thanks in advance!
Since your range has the form [5 n - 3, 5 n - 2, 5 n - 1] (where n ≥ 1), use the following code:
li:nth-child(5n - 3), li:nth-child(5n - 2), li:nth-child(5n - 1) {
color: red;
}
<ul>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
<li>Test</li>
</ul>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With