Home > Web Front-end > CSS Tutorial > What is the difference between css external links and imported css

What is the difference between css external links and imported css

王林
Release: 2020-11-16 14:21:06
Original
4589 people have browsed it

The difference between the external link type and the imported type of css is: the external link type loads the css layout file into the web page file first, while the imported type loads the web page file first and then loads the layout file. Using import can avoid too many web page files pointing to a css layout file.

What is the difference between css external links and imported css

The difference analysis is as follows:

(Learning video recommendation: css video tutorial)

External Chained style

<link rel="stylesheet" href="css/test.css">
Copy after login

Imported style

@import "css/test.css";
Copy after login

The initial results of both are the same, which is to introduce independent css files into web page files.

But there are still subtle differences between the two. Link loads the css layout file into the web page file first, so no matter how slow the network speed is, the final web page effect will be the same. @import loads the web page file first, and then loads the layout file. If the network speed is too slow at this time, the web page effect without layout will appear first, which will look ugly.

But importing styles can avoid too many webpage files pointing to a css layout file. If you use a link, it may cause a slowdown due to too many webpage files using one layout file at the same time. But using a good hard drive will basically not cause this situation.

Related recommendations: CSS tutorial

The above is the detailed content of What is the difference between css external links and imported css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template