:nth-child()

Selects children by position, like odd rows or every third item.

What does :nth-child() do?

:nth-child() picks children by position: a number, odd, even, or a pattern like 3n for every third one.

tr:nth-child(even) { background: #f5f5f5; }   /* striped table rows */

Level: Apprentice · More CSS terms at this level

Updated