Difference between css and @ import, and css @ import

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.