The solution to garbled css files is to unify the css encoding and html page encoding. Methods are as follows: 1. Use Notepad to open the source code and save the encoding as "ANSI"; 2. Use Notepad to open the source code and encode it. Save as "UTF-8".
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Solution: Unify css coding and html page coding.
If the html page is utf-8, css, and js are also unified into utf-8 encoding. If the html page is gb2312, css, and js are also unified into gb2312 encoding.
Specific method:
1. If you want to convert utf-8 to GB2312
1), use Notepad to open the source code and change Replace with ; if it is JS There is no need to add this sentence. If it is a web page, it is best to add this sentence and the encoding corresponding to your page.
2) Use Notepad to open the source code, save it as, and select ANSI for encoding.
2. If you want to convert GB2312 to utf-8
1), use Notepad to open the source code, and change Replace with ; If it is JS, there is no need to add this sentence. If it is a web page It is best to add this sentence and the encoding corresponding to your page.
2) Use Notepad to open the source code, save it as, and select UTF-8 for encoding.
Special reminder: The encoding of CSS should be consistent with the encoding of the web page, because there is an old browser called IE6, and its market share is still very high. CSS with inconsistent encoding will not work under IE6.
【Recommended learning: css video tutorial】
The above is the detailed content of How to solve the problem of garbled css files. For more information, please follow other related articles on the PHP Chinese website!