@import或< link>用于导入样式表? [英] @import or <link> for importing stylesheets?
问题描述
哪种方法最适合导入多个样式表?一种方法比另一种方法更有效?
Which method is best for importing multiple stylesheets? Is one method more efficient than the other?
推荐答案
我曾经读过这篇关于性能和 link>
vs @import
:不要使用@import ;引用它的一小部分:
I once read this article about performances and <link>
vs @import
: don’t use @import ; quoting a small portion of it :
使用LINK而不是@import如果
需要样式表在
中下载平行导致更快的页面。
use LINK instead of @import if you want stylesheets to download in parallel resulting in a faster page.
这是最近的(2009年4月),所以应该仍然是真的 -
It's quite recent (April 2009), so should still be mostly true -- and written by Steve Souders, whose name is quite well-known when it comes to front-end performances.
在一个更主观的观点,我更喜欢使用几个< link>
从我的主HTML文件:这种方式,我能够看到,只有一眼快速看到什么css文件被调用 - 看看模板文件或者查看客户端生成的HTML源代码。
On a more subjective point, I quite prefer using several <link>
from my main HTML file : this way, I am able to see in only a quick glance what css files are called -- either looking at the template file on the server, or looking at the generated HTML source on the client side.
这篇关于@import或< link>用于导入样式表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!