CSS non-ASCII character best practices, cssascii Best Practices
Author: zhanhailiang Date:
Problem scenarios
Attribute values of non-ASCII characters are often used when writing styles, as follows:
. Hot_list. sign_discount: before {content: ""; padding: 0 8px; margin-right: 7px; font-size: 12px; line-height: 14px; color: # fff; text-align: center; background-color: # f13993; border-radius: 11px ;}
However, garbled characters may sometimes appear in Chrome:
In addition to content, font fonts are also frequently used for non-ASCII characters, such as font-family: ""
Best practices
To avoid the above Encoding Problems, we recommend that you use backslash escape when non-ASCII characters are involved in CSS to avoid Encoding Problems:
Backslash escapes allow authors to refer to characters they cannot easily put in a document. in this case, the backslash is followed by at most six hexadecimal digits (0 .. 9A .. f), which stand for the ISO 10646 ([iso000046]) character with that number, which must not be zero. (It is undefined in CSS2.1 what happens if a style sheet does contain a character with Unicode codepoint zero .) if a character in the range [0-9a-fA-F] follows the hexadecimal number, the end of the number needs to be made clear.
See http://www.w3.org/TR/CSS2/syndata.html#escaped-characters for details
Therefore, the preceding example can be changed:
.hot_list .sign_discount:before { content: "\6ee1\51cf"; padding: 0 8px; margin-right: 7px; font-size: 12px; line-height: 14px; color: #fff; text-align: center; background-color: #f13993; border-radius: 11px;}
If the ASCII code of character 0 is 48, the ASCII code of character 9 is
B .57
The ASCII code is like this. If it is not encoded like this, it is not called the ASCII code.
Among the following characters, the minimum ASCII value is A: a B: A C: x D: Y.
Answer: B.
The ascii code of an uppercase letter is smaller than that of a lower-case letter, and the former ascii code is smaller than that of an upper-case or lower-case letter.