Using the :nth-child pseudo class, what would be the most efficient way to style every third item in a list, no matter how many items are present, starting with item 2?

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest
  • li:nth-child(3 + 2n) {
    margin: 0 5 px;
    }
  • li:nth-child(3n + 2) {
    margin: 0 5 px;
    }
  • li:nth-child(2),
    li:nth-child(5),
    li:nth-child(8) {
    margin: 0 5 px;
    }
  • li:nth-child(2n + 3) {
    margin: 0 5 px;
    }
0/5 (0 Reviews)

Like this article?

Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Related Posts