Home  >  Article  >  Web Front-end  >  Summarize the differences between link and @import in loading css

Summarize the differences between link and @import in loading css

零下一度
零下一度Original
2017-05-09 14:14:571448browse

Two ways to load css: 2cdf5bf648cf2f33323966d7f58a7f3f @import

  • ##Way

       <link rel="stylesheet" href="a.css" />
        @import url("b.css");

  • Comparative explanation

    • How to set styles: inline style, inline style, outline style, import Style

    • When @import is used with inline style

      c9ccee2e6ea535a969eb3f532ad9fe89531ac245ce3e4fe3d50054a55f265927, inline style>import style

    • Except for the above situation, at other times, the style loading order is used as a reference, and the later loaded

      priority is higher. (Already tested, you can also refer here) Remember when testing, you must use the same selector for the same element to test, otherwise there will be interference from the selector weight.

    • link belongs to the X

      HTML tag , and @import is provided by CSS; in addition to loading CSS, the link tag can also do many other things. @import can only load CSS.

    • import can only be recognized in IE5 or above, and link is an XHTML tag, so there is no compatibility issue;

    • When the page is loaded, link will are loaded at the same time, and the CSS referenced by @import

      will wait until the page is loaded before loading;

    • About priority

    • Things to note when using import: This rule must be declared first in the head of the style sheet. And the semicolon after it is required. If this semicolon is omitted, the external style sheet will not be imported correctly and

      error message will be generated.

    【Related recommendations】

    1.

    Free css online video tutorial

    2.

    css online manual

    3.

    php.cn Dugu Jiujian (2)-css video tutorial

The above is the detailed content of Summarize the differences between link and @import in loading css. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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