Skip to main content

selector-attribute-quotes

需要或禁止对属性值使用引号。

¥Require or disallow quotes for attribute values.

[target="_blank"] {}
/** ↑ ↑

* These quotes */

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

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

选项

¥Options

string"always"|"never"

"always"

属性值必须始终加引号。

¥Attribute values must always be quoted.

以下模式被视为问题:

¥The following patterns are considered problems:

[title=flower] {}
[class^=top] {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

[title] {}
[target="_blank"] {}
[class|="top"] {}
[title~='text'] {}
[data-attribute='component'] {}

"never"

属性值绝不能加引号。

¥Attribute values must never be quoted.

以下模式被视为问题:

¥The following patterns are considered problems:

[target="_blank"] {}
[class|="top"] {}
[title~='text'] {}
[data-attribute='component'] {}

以下模式不被视为问题:

¥The following patterns are not considered problems:

[title] {}
[title=flower] {}
[class^=top] {}