Home  >  Article  >  Web Front-end  >  Why external css doesn’t work

Why external css doesn’t work

藏色散人
藏色散人Original
2020-12-31 09:08:493835browse

Reasons why external css does not work: 1. The associated path is wrong; 2. The encoding of the style sheet saved is wrong; 3. The browser's slow network speed or slow space speed causes CSS loading failure; 4. Browser compatibility Sexual issues cause css not to work.

Why external css doesn’t work

#The operating environment of this tutorial: Dell G3 computer, Windows 7 system, css3 version.

External css does not work?

Cause:

1. Error in associated path

When the web page is opened, the style set by CSS is not displayed and is only displayed in its original state. Then it may be that our CSS file path is wrong.

<link rel="stylesheet" href="css/index.css"/>

Solution: quote the correct css path and confirm whether the associated style position and name are correct

2. The encoding of the style sheet saved is wrong

Need to take a look at you Whether the character set of the CSS file is consistent with the character set of the web page that calls the CSS file is the charset attribute.

Solution: When you use the browser to browse the effect, there is a "View--Encoding" on the menu bar of the IE browser. Check the UTF-8 or GBK on the encoding to see if they are the same. a code. It may be caused by inconsistent encoding. Change to the same encoding.

3. Failure to load successfully

  • Network reason

Insufficient IIS space, slow browser network speed, slow space speed Network factors are one of the reasons for CSS loading failure.

Solution: Change network, refresh cache

  • Browser compatibility issues

Due to our own CSS code writing There is a problem. It is not set properly, causing different layout differences in different browsers. In CSS, we call it a css hack.

css hack refers to the processing of compatibility bug errors (such as we often say misalignment) in web content after CSS interpretation between browsers of various versions and brands.

Recommended: "css video tutorial"

The above is the detailed content of Why external css doesn’t work. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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