Skip to main content

selector-not-notation

:not() 伪类选择器指定简单或复杂的表示法。

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

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

* This notation */

在选择器级别 3 中,仅允许单个简单选择器作为 :not() 的参数,而选择器级别 4 允许选择器列表。

¥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" 编写现代选择器级别 4 CSS

    ¥"complex" to author modern Selectors Level 4 CSS

  • "simple" 向后兼容旧版浏览器

    ¥"simple" for backwards compatibility with older browsers

fix 选项 选项可以自动修复此规则报告的大多数问题。

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

message 次要选项 可以接受该规则的参数。

¥The message secondary option can accept the arguments of 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) {}