CSS中带引号和不带引号的属性选择器的区别
The difference between quoted and unquoted attribute selector in CSS
我想知道 css 选择器中带引号和不带引号的属性有什么区别,这对性能有什么影响。
input[type="text"]
/
input[type=text]
提前致谢
以上同理。 identifiers, but must be used when it is a string.
的引号是可选的
string 的一些常见示例包括:
- 包含一个space (
</code>)</li>
<li>以数字开头 (<code>0-9
)
- 数字后包含连字符
这是the full spec of an identifier:
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B WF".
进一步阅读:http://www.w3.org/TR/css3-selectors/#attribute-selectors
我想知道 css 选择器中带引号和不带引号的属性有什么区别,这对性能有什么影响。
input[type="text"]
/
input[type=text]
提前致谢
以上同理。 identifiers, but must be used when it is a string.
的引号是可选的string 的一些常见示例包括:
- 包含一个space (
</code>)</li> <li>以数字开头 (<code>0-9
) - 数字后包含连字符
这是the full spec of an identifier:
In CSS, identifiers (including element names, classes, and IDs in selectors) can contain only the characters [a-zA-Z0-9] and ISO 10646 characters U+00A0 and higher, plus the hyphen (-) and the underscore (_); they cannot start with a digit, two hyphens, or a hyphen followed by a digit. Identifiers can also contain escaped characters and any ISO 10646 character as a numeric code (see next item). For instance, the identifier "B&W?" may be written as "B\&W\?" or "B WF".
进一步阅读:http://www.w3.org/TR/css3-selectors/#attribute-selectors