So I have items set out from a cms and no control over their number.
I want to use css to hide all items over a multiple of 7, but only the last few.
I.e. if there are 10 items I need to hide the last 3, if there are 22 items I need to hide the last one… (the remainder after dividing by 7).
I’ve tried a combination of nth child and nth last child, but haven’t got close!
2
Answers
Sussed - useful for anyone else...
You need to cover a lot of cases. To be more precise, you have 6 different cases based on the position of the
(7n + 1)
item.You can optimize like below: