Skip to content

selector-attribute-quotes

Reports an attribute selector whose value is not quoted ([a=b]).

An unquoted value must be a valid identifier, so a value with a space, a digit at the start or a punctuation mark makes the selector invalid and the rule is dropped. Always quoting avoids the trap.

To fix, wrap the value in quotes: [a="b"].

Reported
...
[a=b], [a="b"], [a], [a~=b i] {}
...
@keyframes k { from { top: 0 } to { top: 1px } }
...
After the fix
...
[a=b], [a="b"], [a], [a~=b i] {}
...
@keyframes k { from { top: 0 } to { top: 1px } }
...
css:
lint:
rules:
selector-attribute-quotes: warn # off (default), warn, error
less:
lint:
rules:
selector-attribute-quotes: warn # off (default), warn, error
scss:
lint:
rules:
selector-attribute-quotes: warn # off (default), warn, error

Enabled by the presets: css/stylelint-standard.

Suppress one line with sudsy-disable-next-line selector-attribute-quotes 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-attribute-quotes full