Skip to content

selector-pseudo-class-no-unknown

Reports a pseudo-class that is not a CSS one. Vendor-prefixed ones are not reported, and the -webkit-scrollbar pseudo-classes count after those pseudo-elements.

A selector with an unknown pseudo-class is invalid, and the browser drops the whole rule, not only the pseudo-class. A typo (:hovr) therefore removes the style for every selector in the list.

To fix, correct the name.

Reported
...
@media (min-resolution: 2x) {}
...
a { background: image-set(url("a.png") 1x); margin: 1PX 2% 1e3em }
a:foo, a:hover, a::foo, a::before, a:before, a:-moz-foo, a:nth-child(even), a:lang(en), a:not(:bar) {}
...
::-webkit-scrollbar-thumb:horizontal {}
a:horizontal {}
@page :first { margin: 1cm }
@font-face {
src: url("a");
...
css:
lint:
rules:
selector-pseudo-class-no-unknown:
level: warn # off (default), warn, error
options:
ignore: []
less:
lint:
rules:
selector-pseudo-class-no-unknown:
level: warn # off (default), warn, error
options:
ignore: []
scss:
lint:
rules:
selector-pseudo-class-no-unknown:
level: warn # off (default), warn, error
options:
ignore: []
Option Type Default Description
ignore list [] Names left out: names, or /regex/.

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line selector-pseudo-class-no-unknown in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint selector-pseudo-class-no-unknown full