The web page uses UTF-8 encoding format, which is not a problem. The problem is that the external CSS file defaults to ANSI encoding and is not saved in UTF-8 format. You may find that this is no problem under normal circumstances, but when the CSS file contains Chinese comments, it may not be satisfactory!
It is estimated that browsers below IE6 cannot parse the CSS file correctly due to encoding issues, so the CSS does not work under IE6. It seems that Microsoft has noticed this problem and fixed it in IE7. But there are still many people using IE6. Therefore, this problem needs to be solved:
Method 1: Save CSS, JS and web page files in UTF-8 format.
Method 2: Remove the Chinese comments in CSS and JS, or change them to English.
The above is that IE6 cannot correctly parse CSS files due to encoding problems.
Sometimes we find that when the html page we write refers to an external css file, it can be parsed well in IE7 and FF, that is, it can be displayed normally, but it is completely displayed in IE6. It is not parsed, that is, the styles in the css file are not applied to our html page at all. What is going on? At first, I copied and pasted all the styles in the css file into <style></style> in the html page. After doing this, IE6, IE7, and FF can all display normally, which means that the external css file should What is the problem? Why does this problem occur in IE6 but not in IE7 and FF? I googled online and found that IE6 has strict requirements for page encoding. I checked and found that the css file sent by my friend used GB2312 encoding, while the html file used utf-8. The original problem was Here's the problem. I changed the encoding of the css file content from ed to utf-8. When I tested it again, everything returned to normal. Also, I found that my friend's css file contained Chinese comments. I strongly recommend that friends not use it. The css file is commented in Chinese, which will also cause encoding problems.