In CSS, the forms that are not added to the current page are "linked style sheets" and "imported style sheets". Linked and imported style sheets are collectively referred to as external style sheets. They are a method of writing CSS code into an independent external ".css" file, and then using the link tag or "@import" to reference it into the web page file.
The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.
In CSS, the forms that are not added to the current page are "linked style sheets" and "imported style sheets".
Linked and imported style sheets are collectively called external style sheets. The css code is written in a separate external file. This css style file has the extension ".css".
The external style sheet needs to be referenced into the web page file using the link tag or "@import".
Example:
<!-- 链接外部样式:也就是在与<head>与</head>标记之间加入一个<link>标记。 --> <head> <link href=”style.css” rel=”stylesheet” type=”text/css” /> </head> <!-- 导入外部样式:在内部样式表的<style></style>标记之间导入一个外部样式表,导入时用@import。 --> <style type="text/css"> @import "CssStyle.css"; </style>
[Recommended tutorial: CSS video tutorial]
The imported and linked methods of referencing external styles have almost the same effect. , both reference independent CSS style files into web page files, but there are still some subtle differences between the two (because the design will not be boring enough to create two identical things), the following is based on my Discuss the two aspects we have learned:
1. Using link link css means that when the client browses your web page, it first loads the external CSS file into the web page, and then compiles and displays it, so this The web page displayed in this case has the same effect as we expected, even if the network speed is slow, the effect is the same. The CSS imported using @import is different. When the client browses the web page, it first presents the structure of the html, and then loads the external CSS file into the web page. Of course, the final effect is the same as the former, but when When the network speed is slow, the HTML webpage without CSS unified layout will be displayed first, which will give readers a very bad feeling. This is also the main reason why the CSS of most websites now uses links;
2. Importing styles can prevent too many pages from pointing to one css file. When there are not many pages using the same CSS file in the website, there is almost no difference between the two methods in terms of effect. However, when the number of pages on the website reaches a certain level (such as Sina and other portals), it may be difficult to use the link method. This will cause the speed to drop due to multiple pages calling the same CSS file, but generally websites that can reach this level of page will also have the capital to use the best hard disk, so there is no need to worry about this factor.
Based on the above two factors, we can find that most websites now prefer to use links to reference external CSS.
For more knowledge about computer programming, please visit: Programming Video! !
The above is the detailed content of What is the form in css that is not added to the current page?. For more information, please follow other related articles on the PHP Chinese website!