Difference between css and @ import, and css @ import
Both css and @ import call the external style sheet method.
I. Usage
(1) link:
<Link rel = "stylesheet" type = "text/css" href = "css file path"/>
(2) @ import:
Method 1 (added in html ):
<Style type = "text/css">
@ Import url (css file path );
</Style>
Method 2 (added in css ):
@ Import url (css file path );
Ii. Differences
(1) link is an XHTML tag. In addition to loading CSS, you can also define other transactions such as RRS. @ Import belongs to the CSS category and can only load CSS.
(2) link References CSS styles, which are loaded synchronously with page loading, and @ import starts loading only after the page is loaded.
(3) link is an XHTML tag with no compatibility issues. @ import was proposed in CSS2.1 and is not supported by browsers of earlier versions.
(4) link supports controlling DOM to change styles using Javascript, but @ import does not.