Why is this an issue?

An An+B selector such as :nth-child() or :nth-of-type() only matches elements whose position satisfies the formula inside the pseudo-class. These selectors are one-indexed, so a formula that always evaluates to 0 can never match any element.

When that happens, the selector is dead code. The stylesheet still parses, browsers do not report an error, and the declarations inside the block simply never apply. This is usually caused by a typo such as writing 0 instead of 1 or by copying the wrong formula. To fix it, change the An+B expression so it can match at least one valid position. In practice, that means replacing zero-only formulas such as 0, 0n, or 0n+0 with a formula that can produce a positive index.

Code examples

Noncompliant code example

a:nth-child(0) {
  color: red;
}

li:nth-last-of-type(0 of .active) {
  font-weight: bold;
}

Compliant solution

a:nth-child(1) {
  color: red;
}

li:nth-last-of-type(1 of .active) {
  font-weight: bold;
}

Resources

Documentation