選擇器清單參數的 :nth-child 和 :nth-last-child CSS 偽類別

- WD

:nth-child():nth-last-child() 的最新版本接受一個選擇性的 of S 子句,它會將子項目篩選為僅符合選擇器清單 S 的項目。例如,:nth-child(1 of .foo) 會在具有 foo 類別的子項目中選取第一個子項目(忽略該子項目之前的任何非 foo 子項目)。類似於 :nth-of-type,但適用於任意選擇器,而不僅是類型選擇器。

Chrome

  1. 4 - 110: 不支援
  2. 111 - 123: 支援
  3. 124: 支援
  4. 125 - 127: 支援

Edge

  1. 12 - 110: 不支援
  2. 111 - 123: 支援
  3. 124: 支援

Safari

  1. 3.1 - 8: 不支援
  2. 9 - 17.3: 支援
  3. 17.4: 支援
  4. 17.5 - TP: 支援

Firefox

  1. 2 - 112: 不支援
  2. 113 - 124: 支援
  3. 125: 支援
  4. 126 - 128: 支援

Opera

  1. 9 - 97: 不支援
  2. 98 - 108: 支援
  3. 109: 支援

IE

  1. 5.5 - 10: 不支援
  2. 11: 不支援

Chrome for Android

  1. 124: 支援

Safari on iOS

  1. 3.2 - 8.4: 不支援
  2. 9 - 17.3: 支援
  3. 17.4: 支援
  4. 17.5: 支援

Samsung Internet

  1. 4 - 21: 不支援
  2. 22 - 23: 支援
  3. 24: 支援

Opera Mini

  1. 全部:不支援

Opera Mobile

  1. 10 - 12.1:不支援
  2. 80:支援

UC Browser for Android

  1. 15.5:不支援

Android 瀏覽器

  1. 2.1 - 4.4.4:不支援
  2. 124: 支援

Firefox for Android

  1. 125: 支援

QQ 瀏覽器

  1. 14.9:不支援

百度瀏覽器

  1. 13.52:不支援

KaiOS 瀏覽器

  1. 2.5:不支援
  2. 3:不支援

有關僅支援 :nth-child() 的資訊,請參閱 CSS3 選擇器支援

資源
Chromium 問題 304163:實作 :nth-child(an+b of S) 和 :nth-last-child(an+b of S) 偽類別
Mozilla 錯誤 854148 - 支援 :nth-child(An+B of sel)、:nth-last-child(An+B of sel) 偽類別
MS Edge 平台狀態:正在考慮中