The following small series for everyone to bring a brief talk about CSS and @import differences and usage. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.
Both CSS and @import are methods that call external style sheets.
First, usage
(1) Link:
<link rel= "stylesheet" type= "Text/css" href= "CSS file path"/>
(2) @import:
Method one (added in HTML):
<style type= "Text/css" >
@import url (CSS file path);
</style>
Method Two (added in CSS):
@import url (CSS file path);
Second, the difference
(1) Link is an XHTML tag that, in addition to loading CSS, can also define other transactions such as RRs. @import belong to the CSS category, only CSS can be loaded.
(2) Link refers to the CSS style, is loaded synchronously with the page load, @import is loaded after the page loads.
(3) Link is XHTML label, no compatibility problem, @import is proposed in CSS2.1, the lower version of the browser is not supported.
(4) Link supports the use of JavaScript to control the DOM to change styles, while @import is not supported.
The above discussion of the CSS and @import differences and usage is the small part of the whole content to share to everyone, I hope we can give you a reference, but also hope that we support a lot of topic.alibabacloud.com.