Prev | Current Page 138 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"

2+ Saf3+ FF1+ IE7
FULL BUGGY FULL NONE
The Ultimate CSS Reference 90
Compatibility
Opera Safari Firefox Internet Explorer
9.2 3.0 2.0 1.3 2.0 1.5 1.0 7.0 6.0 5.5
Full Buggy None None Full Full Full None None None
In Safari 3, this selector only matches elements on which the attribute is set
explicitly??”not those for which it??™s inherited.
Other Relevant Stuff
Attribute Selector (p. 67)
selects elements based on attribute values
CSS3 Pseudo-classes
CSS3 provides many more pseudo-classes than CSS2. Though browser support for
them is varied, it is improving.
:nth-child(N)
:nth-child( { 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.
The 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
This example selector will match
odd-numbered table rows:
tr:nth-child(odd) {
?‹® declarations
}
If N is a number or a number expression, N matches elements that are preceded by
N siblings in the document tree.


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