I'm in a situation where the number of elements shown is variable, and I need a strange solution that I'm not able to achieve, I even doubt if it's achievable only with CSS.
I need to select the last child if my number of elements is odd, and the last 2 children if the number of elements is even.
I've been trying with nth-last-child
, :not(:nth-last-child())
, odd and even, but never got a good solution.
Does anyone have any idea/advice about this issue besides adding a class "odd" like on HTML tables?
Thanks a lot in advance!