CSS link and @import difference usage

Source: Internet
Author: User

Here link and @import introduce the syntax words that HTML introduces into CSS. Both are the words that introduce CSS to HTML.

1. LINK syntax structure
<link rel= "stylesheet" type= "Text/css" href= "Cssurl path"/>

Practical application:

2. @import Grammatical structure

@import + space + URL (CSS file path address);

1), in HTML
<style type= "Text/css" >
@import url (CSS file path address);
</style>

2), in CSS
Direct use
@import url (CSS file path address);

Two, link and @import difference and choice

Home link and import syntax structure, the former <link> is HTML tags, can only be used in HTML source code, the latter can be seen as a CSS style, the role is to introduce CSS style features.

Import requires <style type= "Text/css" > tags when using HTML. You can also put in CSS files or CSS code to introduce other CSS files.

In essence, there is little difference between the use of choice, but for the software to edit the layout of the HTML code, generally use link, also recommended to use link.

CSS link and @import difference usage

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.