Home > Web Front-end > HTML Tutorial > The difference between css and @import usage

The difference between css and @import usage

WBOY
Release: 2016-08-22 10:13:55
Original
1618 people have browsed it

css and @import are both methods of calling external style sheets.

1. Usage

(1)link:

(2)@import:

Method 1 (added in html):

Method 2 (added in css):

@import url(css file path);

2. Difference

(1) link is an XHTML tag. In addition to loading CSS, it can also define other transactions such as RRS. @import belongs to the CSS category and can only load CSS.

(2) The link references the CSS style, which is loaded synchronously with the page loading. @import waits until the page is loaded before starting to load.

(3) link is an XHTML tag and has no compatibility issues; @import was proposed in CSS2.1 and is not supported by lower version browsers.

(4) link supports using Javascript to control the DOM to change the style; while @import does not support it.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template