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)?
It’s not really intuitive indeed, but I’m not sure if the Powers That Be aimed for that in the first place.
Another example….. Where p:first-letter means “the first letter of the p element”, it’s different for p:first-child which obviously doesn’t mean “the first child of the p element” but “the p element that IS the first child”.
Obviously, that’s the difference between pseudo-classes and pseudo-elements, but since it’s written the same way (the semicolon), I agree that it can lead to some confusion. And so I guess that’s the same with the parents/ancestors/children…..there’s probably a good reason why it’s not as intuitive as it is, but ah. That’s the way it is, I guess.
Hope this answer doesn’t upset you in any way. Wouldn’t hurt to be a little nicer to @Joshuanhibbert, though.