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)?

#104626

@nikolai I must admit, I cannot understand the confusion that you are having, and as such am having difficulty answering your question. With that said, it would be nice if you could be a little more polite, after all, I am taking the time to try to help you.

I personally disagree that child-of-parent would be better than simply using child; a child must have a parent to exist.

In regards to your last sentence (and my example), there is nothing wrong with that at all. In fact, that is how CSS is designed. If you want to target only direct descendants, then feel free to use the direct descendant selector. I would like to hear why you believe that is so wrong though, perhaps I have been incorrect all this time.