Prev | Current Page 144 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

Using these
11 http://www.konqueror.org/
The Ultimate CSS Reference 96
pseudo-classes can be a little confusing at first, but it??™s easy once you get the hang
of it. The pseudo-classes are:
?–  :nth-child(N) (p. 90)
?–  :nth-last-child(N) (p. 92)
?–  :nth-of-type(N) (p. 93)
?–  :nth-last-of-type(N) (p. 95)
The argument, N, can be a keyword, a number, or a number expression of the form
an+b.
These pseudo-classes accept the keywords odd, for selecting odd-numbered elements,
and even, for selecting even-numbered elements.
If the argument N is a number, it represents the ordinal position of the selected
element. For example, if the argument is 5, the fifth element will be selected.
The argument N can also be given as an+b, where a and b are integers (for example,
3n+1).
In that expression, the number b represents the ordinal position of the first element
that we want to match, and the number a represents the ordinal number of every
element we want to match after that. So our example expression 3n+1 will match
the first element, and every third element after that: the first, fourth, seventh, tenth,
and so on.


Pages:
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156