HTML and CSS Reference
In-Depth Information
:nth-last-child( a n+ b )
Applies to:
Any element
Matches every nth child with the pattern of selection defined by the formula an+b, where a
and bare <integer> s and n represents an infinite series of integers, countingbackwardfrom
thelastchild. Thus, to select every fourth-to-last child of the body element, starting with the
last child, you write body > *:nth-last-child(4n+1) . This is in effect the mirror image of
:nth-child .
In place of the an+bformula, there are two keywords permitted: even and odd . These are
equivalent to 2n and 2n+1 , respectively.
*:nth-last-child(4n+1) {font-weight: bold;}
tbody tr:nth-last-child(odd) {background-color: #EEF;}
Search WWH ::

Custom Search