Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

6 reasons CSS load failed


May 04, 2021 CSS


Table of contents


There are a lot of new to CSS who sometimes experience CSS load failures, but when testing, the style is not displayed on the page, which means that CSS loading failed. This situation is generally due to the CSS path is not written correctly, or in the browser to prevent the loading of CSS, you can restart the browser refresh, in the file CSS calls, generally through link plus your path to achieve, you can see the code:

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>index</title>

<link rel='stylesheet' type='text/css' href='./css/index1.css'>//注意好文件名的书写就没问题了。

There are many reasons why CSS loading failure, which may be incorrect with you, browser, path, encoding, etc. are associated.So specific analysis in the specific situation.The most common causes of failure have the following categories:


Network reason

IIS Insufficient space, slow online speed, slow space, etc. is one of the reasons why CSS loading failed, its specific performance is: When we open a web page, the webline layout is complete, but there is no layout style display.

2. Path error or code is not compatible

If the web page is turned on, the style of the CSS setting is displayed only, only in the original state.Then there may be our CSS file path error or the CSS code is not compatible.

3.IF causes failure

The third reason is that when we have written CSS, it may use the IF judgment statement to call what the browser calls what CSS files that causes IF calls, resulting in normally displayed on some browsers, in some browsingThe device cannot be displayed normally.For this reason, the solution is to check the IF judgment settings that causing the CSS load failed.


4. Alternative CSS loading failed

What is alternative CSS loading failed?This is because we have a problem with the CSS code written by our own CSS code, and there is no setting to display different layout gaps in each browser.In CSS, we call css hack


6 reasons CSS load failed

5, browser causes

Looking at the CSS files under the error console of the Chrome browser, if the CSS file is loaded, determine the loaded, check the class name of the element is the same as the class name defined in the CSS.It may be limited to the IE browser, and you will have an error with Google's browser.So try to change your browser, then wait for it, or it may fix the fault.

6, the encoding is wrong

If it is not the above problem, look at whether you look at the character set of your CSS file and the character set of your call CSS file, is the charset property there.When you use the browser to browse the effect, there is a "View-Encod" on the menu bar in the IE browser, where you are using the UTF-8 or GBK to see if it is the same code.It may be caused by inconsistencies between codes.

The above is the most common six causes of CSS loading failure.After we understand these reasons, if you encounter similar problems in the actual operation, you can investigate and troubleshoot the problem of the disease.