I am in a situation where the number of displayed elements is variable, and I need a strange solution that I can not achieve, I even doubt that this is possible only with css.
I need to select last-child if my number of elements is odd, and last 2nd child if the number of elements is even.
I tried with nth-last-child :not(:nth-last-child()) , odd and even, but never got a good solution.
Does anyone have any ideas / advice on this issue regarding adding the "odd" class, for example, to html tables?
Many thanks!
source share