跳至主要內容

選擇器 AND/OR 無無法匹配值

禁止不匹配的 An+B 選擇器。

a:nth-child(0n+0) {}
/*↑ ↑
* This unmatchable An+B selector */

An+B 選擇器是一對一的。永遠評估為 0 的選擇器不會匹配任何元素。

message 次要選項可以接受此規則的參數。

選項

true

以下模式被視為問題

a:nth-child(0) {}
a:nth-last-child(0n) {}
a:nth-of-type(0n+0) {}
a:nth-last-of-type(0 of a) {}

以下模式被視為問題

a:nth-child(1) {}
a:nth-last-child(1n) {}
a:nth-of-type(1n+0) {}
a:nth-last-of-type(1 of a) {}