The difference between css link style and import style

高洛峰
Release: 2016-12-16 15:55:23
Original
4429 people have browsed it

Link type:

<link href="style.css" rel="stylesheet" type="text/css"/>
Copy after login

Import type:

<style type="text/css">  
 @import"style.css";  
</style>
Copy after login

Difference: When using the link method, the css file will be loaded before loading the main part of the page, so that the displayed web page will have styles from the beginning
      Load the css file after the page is loaded. For some browsers, in some cases, if the web page file is relatively large, the unstyled page will be displayed first, and then the styled effect will appear after a flash.

For larger websites, in order to facilitate maintenance, you may want to classify all css styles into several css files. In this way, if you use link import, you need several statements to import css separately. If you want to adjust the css When classifying files, you need to adjust the HTML files as well. This is a drawback for maintenance work. If you use the import type, you can only import a general css file, and then import other independent css files in this file; links do not have this feature



More css link type and import type For articles related to differences, please pay attention to the PHP Chinese website!

Related labels:
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