There are several ways to do this with varying degrees of specificity in case it matters to you.
One, as already suggested by lonesomeday, with specificity (0, 3, 0) (3 pseudo-classes, with :not(:only-child)
equally specific for :only-child
):
:nth-child(odd):last-child:not(:only-child)
Another, with specifics (0, 2, 0):
:nth-child(2n+3):last-child
The expression 2n + 3 begins to match the third child ahead, eliminating the need for :not(:only-child)
. (For comparison, the keyword "odd" is 2n + 1.)
source share