Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Short version? <code>@import</code> is not supported in old browsers, in certain situation has problems with certain browsers in common use (IE6 <strong>and</strong> IE7), can behave differently in different browsers when it does work and offers no advantage over <code>&lt;link&gt;</code>.</p> <p>Long version? You want to use <code>&lt;link&gt;</code> but there are a couple of scenarios (now mostly irrelevant) where using <code>@import</code> made sense. From <a href="http://webdesign.about.com/od/beginningcss/f/css_import_link.htm" rel="noreferrer">What's the Difference Between @import and link for CSS?</a>:</p> <blockquote> <p>The most common reason given for using @import instead (or along with) is because older browsers didn't recognize @import, so you could hide styles from them.</p> </blockquote> <p>That's talking about hiding things from IE4, which is why I said "mostly irrelevant". One of those cases hides things from IE6 but that's better done with <a href="http://www.quirksmode.org/css/condcom.html" rel="noreferrer">Conditional comments</a>.</p> <p>A more modern (and relevant) comparison is in <a href="http://www.cssnewbie.com/css-import-rule/" rel="noreferrer">Using the CSS @import Rule</a>:</p> <blockquote> <p>nternet Explorer (you knew it’d come up eventually) doesn’t deal well with specifying media types – it chokes. Basically, IE (versions 4-7) try to read the media type like it were part of the file name, causing the whole thing to come crashing down. As such, if you don’t want your CSS to have a default media type of “all,” you’re probably better off using a combination of the tag and imports – specifying a media type in your link, and then importing the appropriate CSS within the file you’re linking to. I haven’t yet heard if IE8 suffers from this same problem (if you happen to know, please enlighten me in the comments!).</p> </blockquote> <p>Another source is Yahoo's <a href="http://developer.yahoo.com/performance/rules.html" rel="noreferrer">Best Practices for Speeding Up Your Web Site</a>:</p> <blockquote> <p>One of the previous best practices states that CSS should be at the top in order to allow for progressive rendering.</p> <p>In IE <code>@import</code> behaves the same as using at the bottom of the page, so it's best not to use it.</p> </blockquote> <p>but doesn't <em>really</em> explain why (hence the previous links).</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload