This question has already been answered:

I recently saw this question about creating a separate style for the last third element .

How can you make it so that every fourth menu item stands out?

<ol> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> </ol> 

Reported as a duplicate by participants Yuri , user207618, Sasha Omelchenko , Community Spirit Mar 7 '17 at 2:08 pm .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Do you yourself do not think this question is a complete duplicate? - Sasha Omelchenko

1 answer 1

Everything is done in the same way. Only all the threes are changed into fours:

 ol li:nth-child(4n+4):nth-last-child(-n+4) { color: red; } 
 <ol> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> </ol> <ol> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> </ol> <ol> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> <li>Пункт</li> </ol> 

This generally applies to all numbers.

  • Why answer if duplicate? - user207618
  • Sorry, right off the bat :( - user238662
  • It is necessary to add this information to the original answer, and this one should be burned - vp_arth