CSS3 :nth-last-of-type() Selector
Specify a foundation shading for each <p> component that is the second p component of its parent, checking from the last child:
More "Attempt it Yourself" precedents below.
Definition and Usage
The :nth-last-of-type(n) selector coordinates each component that is the nth kid, of a specific kind, of its parent, checking from the last child.
n can be a number, a watchword, or a formula.
Tip: Look at the :nth-last-child() selector to choose the component that is the nth tyke, regardless of type, of its parent, tallying from the last child.
The numbers in the table indicates the principal program form that completely bolsters the selector.
Odd and even are catchphrases that can be utilized to coordinate kid components whose list is odd or even (the file of the main kid is 1).
Here, we determine two diverse foundation hues for odd and even p elements:
Using an equation (an + b). Depiction: a speaks to a cycle measure, n is a counter (begins at 0), and b is an counterbalance value.
Here, we indicate a foundation shading for all p components whose file is a different of 3: