In HTML, there are four methods to introduce CSS: inline, embedded, imported, and linked.
1. inline style: Set the CSS style in the marked style attribute. This method does not reflect the advantages of CSS in nature, so it is not recommended.
2. Embedded: the setting of various elements on the page is concentrated between 3. Import: the import format is as follows:
<Style type = "text/CSS">
@ Import "mystyle.css ";
</Style>
4. connector: format:
<Link href = "mystyle.css" rel = "stylesheet" type = "text/CSS"/>
The Display Effect of the last two methods is slightly different. The differences are as follows:
Connector: the CSS file is loaded before the page body is loaded, so that the displayed webpage has a style effect from the beginning;
Imported: the CSS file is loaded after the entire page is loaded. For Some browsers, if the size of the webpage file is large, A page with no style is displayed, and the effect after the style is set is displayed. This is a defect of the pilot type from the perspective of the viewer.
For some large websites, in order to facilitate maintenance, you may want to put all CSS styles into several CSS files by category. If you use a connector, several statements are required to import the CSS file. If you want to adjust the classification of CSS files, you need to adjust the HTML files at the same time. This is a defect in the maintenance work. If you use the pilot type, you can only introduce one total CSS file, import other independent CSS files in this file, but the connection does not have this feature.
Therefore, we recommend that you use the connection method if you only need to introduce one CSS file. If you need to introduce multiple CSS files, first, introduce a "directory" CSS file using the connection method. In this "directory" CSS file, use the pilot method to introduce other CSS files.
If you want to use JavaScript to dynamically decide which CSS file to introduce, you must use a connector.
Link: http://hi.baidu.com/noahsark7/blog/item/3e5488b467f9bc7b8bd4b22f.html