i have a website and i have multiple css style sheet for print, tv, screen, handheld etc...
我有一个网站,我有多个css样式表用于打印,电视,屏幕,手持等...
i want to know which one of these method is better to use (performance, usability, etc...)
我想知道哪种方法更好用(性能,可用性等......)
<link href="all.css" media="all" type="text/css" />
<link href="handheld.css" media="handheld" type="text/css" />
<link href="tv_print.css" media="tv, print" type="text/css" />
or
要么
<style type="text/css">
@import url("all.css") all;
@import url("handheld.css") handheld;
@import url("tv_print.css") tv, print;
</style>
thank you
谢谢
1 个解决方案
#1
20
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.
主要原因是IE 6,7和8中存在一个错误(不确定大约9或更高)意味着当你将@import与链接一起使用时,文件是按顺序加载而不是并行加载。当使用多个样式表时,这会减慢很多事情。
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.
只是串联使用@import下载,但订单无法保证,这意味着如果有重置,例如,可能首先应用也可能不应用。
This article has a good summary: http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
本文有一个很好的总结:http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
#1
20
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.
主要原因是IE 6,7和8中存在一个错误(不确定大约9或更高)意味着当你将@import与链接一起使用时,文件是按顺序加载而不是并行加载。当使用多个样式表时,这会减慢很多事情。
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.
只是串联使用@import下载,但订单无法保证,这意味着如果有重置,例如,可能首先应用也可能不应用。
This article has a good summary: http://www.stevesouders.com/blog/2009/04/09/dont-use-import/
本文有一个很好的总结:http://www.stevesouders.com/blog/2009/04/09/dont-use-import/