Home >Web Front-end >CSS Tutorial >What to do if css is not recognized by Microsoft Yahei

What to do if css is not recognized by Microsoft Yahei

藏色散人
藏色散人Original
2020-12-15 09:39:333284browse

css微软雅黑不识别的解决办法是采用字体的别名,其语句如“font-family:"SimHei" (font-family:"\9ed1\4f53" )”。

What to do if css is not recognized by Microsoft Yahei

本教程操作环境:windows7系统、HTML5&&CSS3版,Dell G3电脑。

推荐:《css视频教程

css设置font-family: "微软雅黑"不识别怎么解决?

建议使用font-family: "Microsoft YaHei";。支持UTF-8和GB2312字符集。

原因:中文字体容易引起乱码

乱码实例:

正常代码:

font-family:"黑体"

引起的乱码:

font-family:"榛戜綋"

上例为乱码使得字体名称变成乱码,导致指定字体失效。这个问题的后果似乎不是很严重,但实际情况中,确实存在一种乱码把后面的引号“变异”的情况,使得后面的CSS都在字体的引号中,从而后面的CSS全部失效。

防范措施:采用字体的别名(所以浏览器都可识别)

示例:

正常代码:

font-family:"SimHei" (font-family:"\9ed1\4f53" )

浏览器解析:

font-family:"SimHei"
(font-family:"黑体",IE6仍为font-family:"\9ed1\4f53" 但字体解析显示为黑体)

使用别名,绕开了使用中文,从而避免乱码。

The above is the detailed content of What to do if css is not recognized by Microsoft Yahei. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn