Resolve HTML External Reference CSS file does not take effect

Source: Internet
Author: User
Tags sublime editor

As a front-end small white, tinker for a few days front end. Today suddenly found that I believe in something, unexpectedly there is a problem. For example, I wrote a CSS style document under the CSS directory: style.css. Then there was only one sentence:

Body {background-color: #ddd;}

And then I'm going to introduce this external CSS in my HTML file:

<link rel= "stylesheet" type= "Text/css" href= "Css/style.css" >
A refresh in the browser: Wow, Kao. No response, no effect. I checked it several times. This path determines that there is no problem, open Chrome's F12 debugger. Make sure the browser loads the CSS file, and then I open the file and see:


Unexpectedly garbled. Should be the encoding is the format of the problem, but it does not matter. Consulted a front-end small partner, after detecting the current encoding of the Web page:


The Utf-16le encoding is displayed:

After I tried, use the sublime editor to modify the local CSS file encoding format for this utf-16le:


Rewritten the CSS code. Save run: Sure enough, you can do it.


But my HTML I specify is Utf-8, and CSS is utf-16, which makes me very uncomfortable. So I asked the solution. Can be solved, and very simple.

Change the CSS back to utf-8 and edit the code inside. Just when HTML introduces this CSS, it's good to declare the encoding format:


That is, add a property to the link tag: charset= "Utf-8" just fine ... In fact, it's so simple ...


Resolve HTML External Reference CSS file does not take effect

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.