4 ms·
If you look at the source for that example, he actually has 2 selectors that set an item to red, corresponding to the 3rd item in a group of 5 and the 7th item
by Kronopath 12y ago
If you look at the source for that example, he actually has 2 selectors that set an item to red, corresponding to the 3rd item in a group of 5 and the 7th item in a group of 9 (Formatted here for legibility):
span:nth-child(3):nth-last-child(3){
background-color:red !important;
}
span:nth-child(7):nth-last-child(3){
background-color:red !important;
}
That threw me for a bit of a loop too. "Wait, is that second item supposed to be red?" It would be clearer if the example and the demo matched up.