Prev | Current Page 147 | Next

Tommy Olsson and Paul O'Brien

"The Ultimate CSS Reference"


The Ultimate CSS Reference 98
:last-child
:last-child {
declaration block
}
This pseudo-class is analogous to the
:first-child pseudo-class (p. 88) that
was included in CSS2. It matches an
element that??™s the last child element of
its parent element, and as such, the
pseudo-class is equivalent to
:nth-last-child(1) (p. 92).
Compatibility
SPEC
CSS3
BROWSER SUPPORT
Op9.2 Saf1.3+ FF1+ IE7
NONE BUGGY BUGGY NONE
Example
This selector will match any paragraph
that??™s the last child element of its parent
element:
p:last-child {
?‹® declarations
}
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
None Buggy Buggy Buggy Buggy Buggy Buggy None None None
In Firefox versions up to and including 2, this selector continues to select the same
element even after another element is dynamically inserted before it.
In Safari versions up to and including 3, this selector will match all elements that
are child elements??”not just the last child element.


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