:nth-child()
Widely available
The :nth-child()
and :nth-last-child()
CSS functional pseudo-classes match elements based on their index within a list of elements. The :first-child
and :last-child
pseudo-classes match the first and last element in a list, and the :only-child
pseudo-class matches an element with no siblings.
To learn more, see
:nth-child(),
:nth-last-child() at MDN.
Compatibility
- Chrome 1 Released on 2008-12-11
- Chrome Android 18 Released on 2012-06-27
- Edge 12 Released on 2015-07-29
- Firefox 3.5 Released on 2009-06-30
- Firefox for Android 4 Released on 2011-03-29
- Safari 3.1 Released on 2008-03-18
- Safari on iOS 2 Released on 2008-07-11