CSS failure in IE6, browser encoding problem, CSS failure in IE

Source: Internet
Author: User

Recently, as a result of the need, I am working on a blog management system. When it is about to be completed, I have never encountered any problems. The page shows normal in IE7 and FF, while in IE6, some CSS codes are invalid. The problem is caused by CSS encoding:

The webpage uses UTF-8 encoding, while CSS uses ANSI encoding. In this case, the CSS style can be recognized by IE8, IE7, and Firefox and will be displayed normally, however, IE6 and earlier versions do not know each other, which leads to the problem described above.

Solution:Use the same encoding for the webpage and CSS file. We recommend that you modify the style of the CSS file to make it consistent with that of the webpage. To modify the CSS file encoding method, you can use editplus to open the CSS file and "Save as". In "encoding", select the same encoding method as the webpage, and then confirm to overwrite the original file.

This is not the caseArticleWhat I want to say is as follows: shortly after the above problems are solved, another encoding problem occurs, that is, all CSS becomes invalid in any browser, dizzy, and finally found, the reason is that in the external CSS file, the first comment statement is garbled due to encoding problems. In fact, the Garbled text of the comment does not affect the output of the aspx file, the key is that the comment end mark * and the comment content are recognized as a character by the browser during encoding, so that the comment statement does not end the mark, and all CSS is commented out, eg:/* place on timeDan */

This is the example"Dan *Because the encoding problem is treated as a character by the browser, the Comment statement will not end, so the following content will be commented out. I have summarized several solutions as follows:

1. Delete all comments to avoid problems (not recommended)

2. Comment in English.

3. The comment mark is separated by a space. For example:/* Comment part */(I think it is the most effective)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.