Convert the font name to unicode encoding
If you use Chinese Characters in CSS, it will cause encoding problems. Therefore, you should use English characters to set Chinese fonts, such:
body { font-family: SimSun; }
SimsunIt is the English name of.
This is the ideal situation. Unfortunately, there is always a gap between the ideal and the reality. Earlier versions of Firefox and Opera (up to version 10) cannot recognize English names of Chinese fonts. Therefore, you need to use the second method:
body { font-family: \5B8B\4F53, SimSun; }
"\ 5b8b \ 4f53" is the Unicode code of the word "". This rule is valid for all browsers.
SimsunIt is equivalent to \ 5b8b \ 4f53, Which is retained here.SimsunTo facilitate reading the code.
A comparison table is provided for your convenience.
List of Chinese names, Unicode codes, and English names in common Chinese Fonts
Chinese name |
Unicode code, English name |
|
\ 5b8b \ 4f53,Simsun |
Xin |
\ 65b0 \ 5b8b \ 4f53,Nsimsun |
Simhei |
\ 9ed1 \ 4f53,SimheI |
Imitation Song |
\ 4eff \ 5b8b,Fangsong |
Imitation Song _ gb2312 |
\ 4eff \ 5b8b_gb2312,Fangsong_gb2312 |
Body |
\ 6977 \ 4f53,Kaiti |
_ Gb2312 |
\ 6977 \ 4f53_gb2312,Kaiti_gb2312 |
|
\ 5fae \ 8f6f \ 96c5 \ 9ed1,"Microsoft yahei" |
Understanding |
\ 7ec6 \ 660e \ 4f53,Mingliu |
New Understanding |
\ 65b0 \ 7ec6 \ 660e \ 4f53,Pmingliu |
Mark |
\ 6807 \ 6977 \ 4f53,Dfkai-sb |
WeChat official black |
\ 5fae \ x8f6f \ 6b63 \ 9ed1 \ 4f53,"Microsoft jhenghei" |