The browser does not load the CSS, the style goes missing

Source: Internet
Author: User
Tags html header browser cache

From: http://www.cnblogs.com/crizygo/p/5466444.html

Problem description: Using Eclipse to modify the style file, the browser's page is not displayed for a moment, and finally did not load the latest CSS style code, directly using the old style code, clear the browser cache, clear the Eclipse cache, and switch different browsers to view the Web page, there is no change , the same result-the latest CSS style files are not loaded.

Try the workaround: 1, clear the browser cache, 2, clear the Eclipse cache, 3, switch between different browsers to view the Web page.

The Final Solution: add: @charset "Utf-8" to the CSS style file and solve the problem.

--------------------------------------------------------------------------------------

Workaround Source:

If your browser does not load the inline CSS (note that it is not all loaded, this excludes some style incompatibility issues):

1. First consider whether the CSS path is wrong.

2. At the beginning of the style of writing comments, and when the Chinese characters in the note is an odd number of characters, and the end of the "* *" combination into a legal character, so that the comments can not be closed in time, so that the subsequent styles are all automatically commented.

The encoding specified in the 3.css file is not uniform with the page, and the browser parses the CSS with page encoding, which naturally makes mistakes. My IE update to IE11 encountered this problem, HTML to the Gb2312,css file header gave the @charset "Utf-8", CSS completely added.

Example: <meta http-equiv= "Content-type" content= "text/html; CHARSET=GBK "/>

<link href= "Join_us.css" type= "Text/css" rel= "stylesheet" charset= "Utf-8" >

(1) The @charset "Utf-8" at the beginning of the external CSS file

(2) The @charset header declaration is not specified in the CSS file, which causes IE to use page encoding to decode the CSS file by default.

Explain here, gb2312 and GBK are the earlier GB code, mainly used to encode and decode commonly used Chinese characters. And Utf-8 is more international, while the Chinese language, English-based platform for the use of utf-8. GBK, GB2312, and UTF8 must be Unicode encoded to convert from one to the other.


4.IE does not support the introduction of external CSS files and hints that the mine type does not match. The. css file is not a minetype type, possibly because this. css file is the suffix of other types (such as TXT) files that you create and then change.

(1) Then rebuild a CSS file and copy the code over.

(2) or download Filestypeman software, directly modify the file suffix of the Minetype type.

5. Take a look at your HTML header's DOCTYPE statement

<! The doctype> declaration is not an HTML tag; it is a directive that instructs the Web browser to write which HTML version of the page to use. In HTML 4.01, <! The doctype> declaration references a DTD because HTML 4.01 is based on SGML. The DTD prescribes the rules of the markup language so that the browser renders the content correctly.

HTML5 is not based on SGML, so you do not need to reference a DTD.

<! DOCTYPE html> HTML5 declaration.

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 frameset//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd" > This is the DW automatically added DTD information on the page file page (can be deleted.) The default DTD is used by the browser after deletion.)

The DTD is equivalent to XHTML 1.0 transitional, but allows frameset content.

There's a lot more ...

Local inline CSS doesn't add up, <! the page header DOCTYPE html> get rid of HTML is OK.

6. If you use @import, the client IE6 will not refresh the CSS when the CSS file changes.

The browser does not load the CSS, the style goes missing

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.