[Webkit-unassigned] [Bug 74200] nth-child:nth-last-child combination failing unexpectedly.

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Jul 12 19:07:17 PDT 2022


https://bugs.webkit.org/show_bug.cgi?id=74200

--- Comment #3 from Chris Kalafarski <chris at farski.com> ---
I suspect this was never an issue, and was just bad math on my part. It's been 11 years, so I don't exactly remember what I was trying to do, but vaguely remember what the intent was, and I think the actual solution would look like this:

      li:nth-child(9n-0):nth-last-child(1) { background: red; }
      li:nth-child(9n-1):nth-last-child(2) { background: red; }
      li:nth-child(9n-2):nth-last-child(3) { background: red; }
      li:nth-child(9n-3):nth-last-child(4) { background: red; }
      li:nth-child(9n-4):nth-last-child(5) { background: red; }
      li:nth-child(9n-5):nth-last-child(6) { background: red; }
      li:nth-child(9n-6):nth-last-child(7) { background: red; }
      li:nth-child(9n-7):nth-last-child(8) { background: red; }
      li:nth-child(9n-8):nth-last-child(9) { background: red; }
      li:nth-child(9n-1):nth-last-child(1) { background: red; }
      li:nth-child(9n-2):nth-last-child(2) { background: red; }
      li:nth-child(9n-3):nth-last-child(3) { background: red; }
      li:nth-child(9n-4):nth-last-child(4) { background: red; }
      li:nth-child(9n-5):nth-last-child(5) { background: red; }
      li:nth-child(9n-6):nth-last-child(6) { background: red; }
      li:nth-child(9n-7):nth-last-child(7) { background: red; }
      li:nth-child(9n-8):nth-last-child(8) { background: red; }
      li:nth-child(9n-2):nth-last-child(1) { background: red; }
      li:nth-child(9n-3):nth-last-child(2) { background: red; }
      li:nth-child(9n-4):nth-last-child(3) { background: red; }
      li:nth-child(9n-5):nth-last-child(4) { background: red; }
      li:nth-child(9n-6):nth-last-child(5) { background: red; }
      li:nth-child(9n-7):nth-last-child(6) { background: red; }
      li:nth-child(9n-8):nth-last-child(7) { background: red; }
      li:nth-child(9n-3):nth-last-child(1) { background: red; }
      li:nth-child(9n-4):nth-last-child(2) { background: red; }
      li:nth-child(9n-5):nth-last-child(3) { background: red; }
      li:nth-child(9n-6):nth-last-child(4) { background: red; }
      li:nth-child(9n-7):nth-last-child(5) { background: red; }
      li:nth-child(9n-8):nth-last-child(6) { background: red; }
      li:nth-child(9n-4):nth-last-child(1) { background: red; }
      li:nth-child(9n-5):nth-last-child(2) { background: red; }
      li:nth-child(9n-6):nth-last-child(3) { background: red; }
      li:nth-child(9n-7):nth-last-child(4) { background: red; }
      li:nth-child(9n-8):nth-last-child(5) { background: red; }
      li:nth-child(9n-5):nth-last-child(1) { background: red; }
      li:nth-child(9n-6):nth-last-child(2) { background: red; }
      li:nth-child(9n-7):nth-last-child(3) { background: red; }
      li:nth-child(9n-8):nth-last-child(4) { background: red; }
      li:nth-child(9n-6):nth-last-child(1) { background: red; }
      li:nth-child(9n-7):nth-last-child(2) { background: red; }
      li:nth-child(9n-8):nth-last-child(3) { background: red; }
      li:nth-child(9n-7):nth-last-child(1) { background: red; }
      li:nth-child(9n-8):nth-last-child(2) { background: red; }
      li:nth-child(9n-8):nth-last-child(1) { background: red; }

Which works as expected (for a grid with 9 columns with an arbitrary number of rows, makes elements in the last row red).

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20220713/16d5c09d/attachment.htm>


More information about the webkit-unassigned mailing list