The :nth-child(an+b) CSS pseudo-class matches an element that has an+b-1 siblings before it in the document tree, for a given positive or zero value for n, and has a parent element. More simply stated, the selector matches a number of child elements whose numeric position in the series of children matches the pattern an+b.

:nth-child(number) {
    css declarations;
}
li:nth-child(3) {
   color: #3366ff;
   background: #ffff99;
}

Click the button below to experiment with this selector.

Give it a Try!

3.5Firefox 9.0Explorer 4.0Chrome 3.2Safari 9,6Opera