Tuesday, October 20, 2009

Child Selectors (Basic CSS Cont.)

Child selectors are similar to descendant selectors, but they select only children rather than all ancestors. Child selectors are indicated by a greater-than sign (>).
  <li>Item one</li>
  <li>Item two</li>
  <li>Item three</li>
  <li>Item four has a nested list
       <li>Sub-item one</li>
       <li>Sub-item two</li>
Whereas our descendant selector, ul li { color: blue; }, targeted all li elements in this
example, a similar child selector would only select the first four li elements, as they are direct children of a ul element:
ul > li {
  color: blue
It would not target those li elements in item four’s nested ol list.
Note: Microsoft Internet Explorer 6 and below does not support child selectors.


  1. Wow,
    really u have shared valuable info about CSS . I read your post and I found it amazing.Your thought process is wonderful. The way you express yourself is awesome.
    website development melbourne

  2. I have read your blog, i got valuable information from your posting. Thanks a lot Website Development Melbourne