Including CSS with `<link>` or `@import` - which is better?

前端 未结 1 1273
礼貌的吻别
礼貌的吻别 2021-02-07 08:10

i have a website and i have multiple css style sheet for print, tv, screen, handheld etc...

i want to know which one of these method is better to use (performance, usabi

相关标签:
1条回答
  • 2021-02-07 08:23

    The first method (link) is the best.

    The main reason is that there is a bug in IE 6,7 and 8 (not sure about 9 or higher) means that when you use @import in conjunction with link the files are loading in series rather than in parallel. This can slow things down a lot when using more than one style sheet.

    Just using @import downloads in series, but the order isn't guaranteed, meaning that if there is a reset for instance, that may or may not be applied first.

    This article has a good summary: http://www.stevesouders.com/blog/2009/04/09/dont-use-import/

    0 讨论(0)
提交回复
热议问题