css - 为什么设置了charset="UTF-8"中文还是乱码呢?并且文件编码也是UTF-8,用的sublime
阿神
阿神 2017-04-17 11:35:46
0
8
972

设置了charset="UTF-8",但是css里凡是涉及到“黑体”“微软雅黑”“楷体”都不能正常显示。
重新用utf-8打开过,也复制到txt里过,通通不行。。。
求拯救,求解脱

 "default_encoding": "UTF-8",
<head>
    <meta charset="UTF-8">
    <title>task_1_6_1</title>
    <link rel="stylesheet" href="task_1_6_1.css">
</head>

代码:https://github.com/louislee0229/louisIFE/tree/gh-pages/task_1_6_1
demo:http://louislee0229.github.io/louisIFE/task_1_6_1/task_1_6_1.html

阿神
阿神

闭关修行中......

reply all(8)
巴扎黑

After identification, the CSS file in the demo is not UTF-8 encoded, but GBK. So the CSS file is interpreted incorrectly using UTF-8

黄舟

Even the names of the pictures are in Chinese, I love using Chinese so much. In order to ensure maximum compatibility, try not to use Chinese to set fonts in CSS files. You can convert Chinese to Unicode and then set it. Please search for the conversion tool yourself.


This code comes from Taobao. The red box indicates the Song font after being converted to Unicode.

小葫芦

Try using notepad++ to save as UTF-8 file

伊谢尔伦

Try adding @charset "utf-8" at the top of the css file

阿神

Add @charset "utf-8" to the header of the css file;

刘奇

Open it with notepad++, adjust it (as shown in the picture) and save it.

左手右手慢动作

Try adding @charset "utf-8"; in the style to see if it has any effect

刘奇

It’s not closed, bastard

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template