Prev | Current Page 141 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

9
Selector Reference
:nth-of-type(N)
:nth-of-type( { number expression | odd | even } )
{
declaration block
}
This pseudo-class matches elements on
the basis of their positions within a
parent element??™s list of child elements
of the same type. This pseudo-class
accepts an argument, N, which can be a
keyword, a number, or a number
expression of the form an+b. For more
information, see Understanding
:nth-child Pseudo-class Expressions (p. 95).
Example
The following example selector matches
the first child paragraph in a div element:
div>p:nth-of-type(1) {
?‹® declarations
}
If N is a number or a number expression, N matches elements that are preceded by
N siblings with the same element name in the document tree.
The following example selector matches the second, fifth, eighth, and so on,
paragraphs in a div element, ignoring any children that aren??™t paragraphs:
div>p:nth-of-type(3n-1) {
?‹® declarations
}
SPEC
CSS3
BROWSER SUPPORT
Op9.2 Saf3 FF2 IE7
NONE NONE NONE NONE
9 http://www.


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