Skip to content

selector-type-no-unknown

Reports a type selector that is not an HTML, SVG or MathML element; custom elements are accepted. Keyframe selectors and the arguments of :lang(), :nth-child() and the like are not reported.

An unknown type selector never matches, so the rule does nothing. It is almost always a typo (dvi) or a class that lost its dot.

To fix, correct the name or add the missing . or #.

Reported
...
a { background: image-set(url("a.png") 1x); margin: 1PX 2% 1e3em }
...
foo, div, b::slotted(x-y), svg > circle {}
::-webkit-scrollbar-thumb:horizontal {}
...
@page :first { margin: 1cm }
...
css:
lint:
rules:
selector-type-no-unknown:
level: warn # off (default), warn, error
options:
ignore: []
less:
lint:
rules:
selector-type-no-unknown:
level: warn # off (default), warn, error
options:
ignore: []
scss:
lint:
rules:
selector-type-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-type-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-type-no-unknown full