Skip to content

selector-pseudo-element-colon-notation

Reports :before, :after, :first-line or :first-letter written with one colon.

CSS3 separated pseudo-elements from pseudo-classes with two colons so the reader can tell them apart. The single colon is kept only for old browsers, and a file that mixes both is inconsistent.

To fix, write ::before.

Reported
a:before, a::after, a:hover {}
...
After the fix
a:before, a::after, a:hover {}
...
css:
lint:
rules:
selector-pseudo-element-colon-notation: warn # off (default), warn, error
less:
lint:
rules:
selector-pseudo-element-colon-notation: warn # off (default), warn, error
scss:
lint:
rules:
selector-pseudo-element-colon-notation: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line selector-pseudo-element-colon-notation 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-element-colon-notation full