Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of garbled external fonts loaded by css

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the knowledge of "how to solve the problem of css loading external font garbled". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Css loading external font garbled solutions: 1, Unicode encoding of Chinese fonts; 2, add "@ charset" utf-8 "" in the CSS file header; 3, set "charset=utf-8" in the html file.

This article operating environment: windows7 system, CSS3 version, Dell G3 computer.

What about the garbled external font loaded by css?

The problem of Font setting referencing abnormal codes in css

The problem of garbled code often bothers engineers, designers, etc., if you don't have a good grasp of coding in css. For example, set the font to Arial: font-family:' Arial'; but one of the problems is that if the CSS encoding is incorrect, it will lead to garbled Chinese fonts in the CSS after the page is loaded.

The following solutions hope to help you solve the problem:

Unicode coding of Chinese fonts is often used to solve this dangerous problem. For example, the character "Song style" is "\ 5b8b\ 4f53" after Unicode coding. Take Taobao as an example: font:12px/1.5 tahoma,arial,\ 5b8b\ 4f53; the pre-selected Chinese font is the encoded Song style.

There is a quick way to obtain font Unicode encoding. If you use Firefox's Firebug plug-in and type escape ('boldface') directly in the console, you can get boldface Unicode encoding, but it needs to be processed before it can be used in CSS files, as shown in the following figure:

You got "% u9ED1%u4F53" here, and rewrite it to "\ 9ED1\ 4F53" to write to the CSS file.

There may still be a little trouble in this way, but it doesn't matter. Here is a relatively complete form for mango. Check it yourself.

Chinese name Unicode new detail type\ 65B0\ 7EC6\ 660E\ 4F53 detail type\ 7EC6\ 660E\ 4F53 standard type\ 6807\ 6977\ 4F53 boldface\ 9ED1\ 4F53 Song\ 5B8B\ 4F53 new type\ 65B0\ 5B8B\ 4F53 imitation Song\ 4EFF\ 5B8B italics\ 6977\ 4F53 imitation Song _ GB2312\ 4EFF\ 5B8B_GB2312 italics _ GB2312\ 6977\ 4F53_GB2312 Microsoft is boldface\ 5FAE\ x8F6F\ 6B63\ 9ED1\ 4F53 Microsoft Yahei\ 5FAE\ 8F6F\ 96C5\ 9ED1

Select the settings file encoding as: UTF-8, open the file with notepad, select the file menu-"Save as, set to UTF-8."

Add @ charset "utf-8"; to the header of the CSS file to explain the format of the file. Of course, you should also set it in the previous page.

If the style is in the html file, Chinese garbled will also appear.

This is because the

Inconsistent with the file encoding format.

Modify the file encoding: open the file with notepad, select the file menu-"Save as, set to UTF-8."

This is the end of the content of "how to solve the problem of css loading external font garbled". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report