Home > Web Front-end > CSS Tutorial > Solution and cause analysis of the problem that IE6 cannot parse CSS files normally_Experience exchange

Solution and cause analysis of the problem that IE6 cannot parse CSS files normally_Experience exchange

WBOY
Release: 2016-05-16 12:04:11
Original
1967 people have browsed it

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 It displays normally, but is not parsed at all in IE6, that is, the styles in the css file are not applied to our html page at all. What's going on? At first, I copied and pasted all the styles in the css file into 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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template