跳到主要内容

selector-not-notation

Specify simple or complex notation for :not() pseudo-class selectors.

    a:not(.foo, .bar) {}
/** ↑
* This notation */

In Selectors Level 3, only a single simple selector was allowed as the argument to :not(), whereas Selectors Level 4 allows a selector list.

Use:

  • "complex" to author modern Selectors Level 4 CSS
  • "simple" for backwards compatibility with older browsers

The fix option option can automatically fix most of the problems reported by this rule.

Options

string: "simple"|"complex"

"simple"

The following patterns are considered problems:

:not(a, div) {}
:not(a.foo) {}

The following patterns are not considered problems:

:not(a):not(div) {}
:not(a) {}

"complex"

The following pattern is considered a problem:

:not(a):not(div) {}

The following patterns are not considered problems:

:not(a, div) {}
:not(a.foo) {}
:not(a).foo:not(:empty) {}