What are the ways to import styles?

零下一度
Release: 2017-06-24 10:57:54
Original
1479 people have browsed it

link and import

"index.css?1.1.11" rel="stylesheet">

Differences

  • linkExcept When quoting style files, you can also cite resource files such as images, while import only cites style files


< link rel="search" type="application/opensearchdescription+xml" href="/content-search.xml" title="Baidu Search" />
    • Compatible Different properties, link does not have compatibility issues, import is supported in IE5 and above, and is new to css2.1

    • In the style sheet file, you can use import to import other style sheet files. However, link cannot

    • #link refers to CSS and is loaded at the same time when the page is loaded; @import requires the page to be loaded after it is fully loaded.

    • link supports using Javascript to control the DOM to change the style; @import does not support it.

      • There are many ways to write import


        @import 'style.css' //Windows IE4/ NS4, Mac OS X IE5, Macintosh IE4 /IE5/NS4 does not recognize
        @import "style.css?1.1.11" //Windows IE4/ NS4, Macintosh IE4/NS4 does not recognize
        @import url(style.css) //Windows NS4, Macintosh NS4 does not recognize
        @import url('style.css') //Windows NS4, Mac OS X IE5, Macintosh IE4/IE5/NS4 does not recognize
        @import url("style.css?1.1.11" ) //Windows NS4, Macintosh NS4 does not recognize
        It is recommended to use @import url(index.css);

The above is the detailed content of What are the ways to import styles?. For more information, please follow other related articles on the PHP Chinese website!

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