selector list argument of :nth-child and :nth-last-child CSS pseudo-classes
- WDThe newest versions of :nth-child()
and :nth-last-child()
accept an optional of S
clause which filters the children to only those which match the selector list S
. For example, :nth-child(1 of .foo)
selects the first child among the children that have the foo
class (ignoring any non-foo
children which precede that child). Similar to :nth-of-type
, but for arbitrary selectors instead of only type selectors.
Chrome
- ❌ 4 - 110: Not supported
- ✅ 111 - 130: Supported
- ✅ 131: Supported
- ✅ 132 - 134: Supported
Edge
- ❌ 12 - 110: Not supported
- ✅ 111 - 130: Supported
- ✅ 131: Supported
Safari
- ❌ 3.1 - 8: Not supported
- ✅ 9 - 18.0: Supported
- ✅ 18.1: Supported
- ✅ 18.2 - TP: Supported
Firefox
- ❌ 2 - 112: Not supported
- ✅ 113 - 131: Supported
- ✅ 132: Supported
- ✅ 133 - 135: Supported
Opera
- ❌ 9 - 97: Not supported
- ✅ 98 - 113: Supported
- ✅ 114: Supported
IE
- ❌ 5.5 - 10: Not supported
- ❌ 11: Not supported
Chrome for Android
- ✅ 131: Supported
Safari on iOS
- ❌ 3.2 - 8.4: Not supported
- ✅ 9 - 18.0: Supported
- ✅ 18.1: Supported
- ✅ 18.2: Supported
Samsung Internet
- ❌ 4 - 21: Not supported
- ✅ 22 - 25: Supported
- ✅ 26: Supported
Opera Mini
- ❌ all: Not supported
Opera Mobile
- ❌ 10 - 12.1: Not supported
- ✅ 80: Supported
UC Browser for Android
- ❌ 15.5: Not supported
Android Browser
- ❌ 2.1 - 4.4.4: Not supported
- ✅ 131: Supported
Firefox for Android
- ✅ 132: Supported
QQ Browser
- ❌ 14.9: Not supported
Baidu Browser
- ❌ 13.52: Not supported
KaiOS Browser
- ❌ 2.5: Not supported
- ❌ 3: Not supported
For support information for just :nth-child()
see CSS3 selector support