I got the problem that I got a variable amount of child-elements. My :last-child :first-child rules should only apply, when there are at least 3 children
I tried :only-child, which can overwrite :last- and :first-child when there is only 1 child, but when I got 2 children, I have a problem. Is there some sort of selector, that only applies, when there are more children than n?
Use the :nth-child(n+3)
selector (where 3 is the nth minimum child).
:last-child:nth-child(n+3) {
/* Selects the last child which is at least the third child */
}
Demo: http://jsfiddle.net/vCZ9A/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With