3 ms·
I've read the ":NTH-OF-M-CHILD" section about five times through now and I still don't understand what objects you're trying to select or why. A clearer explana
by pyrocat 12y ago
I've read the ":NTH-OF-M-CHILD" section about five times through now and I still don't understand what objects you're trying to select or why. A clearer explanation would be helpful.
"For example, we can style the third element, if and only if it’s one of five children:"
That makes sense, except your example has a red background, not a green one, and for some reason the 9th row has a red tile, which doesn't match your requirement that it be "one of five children". Very confusing.
- Kronopath 12y agoIf 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.