试着写了一个html中id="9k" ,css中#9k {color:red;},发现webpack打包后完全不能生效。终于知道了原因所在:
id值不能以数字开头,否则在Mozilla/Firefox/Chrome中无法识别
见官方文档https://www.w3.org/TR/CSS2/syndata.html#characters
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\26 W\3F".