1 will help
put things into perspective. The expression represents a linear number set that??™s
used to match elements. Thus, the first column of the table represents values for n,
and the other columns display the results (for N) of various example expressions.
The expression will match if the result is positive and an element exists in that
position within the document tree.
Table 4.1: Result Sets for Pseudo-class Expressions
-n+3 5n-2 4n 4n+4 4n+1 2n+1 n
3 - - 4 1 1 0
2 3 4 8 5 3 1
1 8 8 12 9 5 2
- 13 12 16 13 7 3
- 18 16 20 17 9 4
- 23 20 24 21 11 5
Selector Reference
Thus the expression 4n+1 will match the first, fifth, ninth, thirteenth, seventeenth,
twenty-first, and so on, elements if they exist, while the expression -n+3 will match
the third, second, and first elements only.
The difference, then, between the nth- and nth-last- pseudo-classes is that nthpseudo-
classes count from the top of the document tree down??”they select elements
that have N siblings before them; meanwhile, the nth-last- pseudo-classes count
from the bottom up??”they select elements that have N siblings after them.
Pages:
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158