Black Lives Matter! ✊🏾


The :nth-last-child(an+b) pseudo-class notation represents an element that has an+b-1 siblings after it in the document tree, for any positive integer or zero value of n. :nth-last-child() pseudo-class

Links about :nth-last-child()

  1. :nth Tester

    by CSS Tricks

  2. Quantity Queries for CSS

    posted on by Heydon Pickering

    In responsive design, we think a lot about space, especially in the context of screen sizes. But the amount of content or the number of elements is bound to affect space, too, just as unpredictably…

  3. :nth-last-child()

    posted on by MDN

    The :nth-last-child() CSS pseudo-class matches elements based on their position among a group of siblings, counting from the end.

Code sample

li:nth-last-child(2n) {
border: 5px solid fuchsia;