What are the ways CSS is introduced? What is the difference between link and @import?

Source: Internet
Author: User

CSS Introduction Method:

1. Inline style (inline style/inline style): Written directly in HTML tags

For example:

<p style= "color: #00AFC7; font:arial; " ></p>

2. Internal style: written between head and head

For example:

<style>

CSS Styles

</style>

3. External style: requires reference to take effect

For example:

1>.<link rel= "stylesheet" href= ". /css/123.css "/>

2>[email protected] URL (.. /CSS/123.CSS)

The difference between link and @import:

Difference 1:

Link is the XHTML tag, in addition to loading CSS, you can also define other transactions such as RSS, @import belong to the CSS category, can only load CSS.

Difference 2:

When link is introduced into CSS, it is loaded at the same time when the page is loaded; @import need to load the page when it is fully loaded.

Difference 3:

Link is an XHTML tag, no compatibility issue, @import is proposed in CSS2.1, the lower version of the browser is not supported.

Difference 4:

Link supports using the JavaScript control DOM to change the style, while @import does not support it.

What are the ways CSS is introduced? What is the difference between link and @import?

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.