Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Why doesn’t nth-child, first-child, blah-child target the child element(s)? Re: Why doesn’t nth-child, first-child, blah-child target the child element(s)?

#104631
Meta_Ing
Participant

As far as I can tell nth-child(3) for example would be better named simply as nth(3), because it’s getting the nth of that element. The fact they are children, appears irrelevant.

I feel like this would create confusion with the *-of-type selectors, which select the first, last, or nth specified element(s) – regardless of their position.

Edit – I’m pretty sure you understand the concept, so I’ll retract the examples.

I think the best way to answer your question is that the term child suggests that you want to select an element if it’s that child, while terms like nth, first, or last might imply that you want to select that instance of the element.