Child Selector

From CSS Discuss

Jump to: navigation, search

Child Selectors (not parent selectors) look like this, and are generally less well supported than Descendant Selectors:

   p>em

The above selector matches this em element, which is a child of the p element:

   <p><em/></p>

But not this em element, which is a descendant of the p element (and a child of the q element):

   <p><q><em/></q></p>

The descendant selector, like this:

   p em

Would match both em elements, since children are descendants:

   <p><em/></p>
   <p><q><em/></q></p>

Support

Support for child selectors is not terribly good, which gives rise to the Child Hack.


Category Selector

Personal tools