2010-05-01 26 views
0

這裏是3 css文件(其中一個是僅適用於IE)多個樣式表減速到網站多少?

<link rel="stylesheet" href="css/blueprint/screen.css" type="text/css" media="screen, projection"> 
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">  
<!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> 

如果我繼續鴻溝scree.css到這些CSS在我的網站

現在,這將是6個CSS(一個是僅適用於IE瀏覽器)

<link rel="stylesheet" href="css/blueprint/reset.css" type="text/css" media="screen, projection"> 
<link rel="stylesheet" href="css/blueprint/grid.css" type="text/css" media="screen, projection"> 
<link rel="stylesheet" href="css/blueprint/typography.css" type="text/css" media="screen, projection"> 
<link rel="stylesheet" href="css/blueprint/forms.css" type="text/css" media="screen, projection"> 
<link rel="stylesheet" href="css/blueprint/print.css" type="text/css" media="print">  
<!--[if lt IE 8]><link rel="stylesheet" href="css/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]--> 

如果我甚至在生產後去網站的方法二。它真的會減慢網站頁面加載速度嗎?如果是的話多少錢?這3個額外樣式表會影響網站性能多少?

回答

6

將它們組合到一個樣式表中減少了瀏覽器加載頁面所需的HTTP請求數。但是,在第一次請求樣式表之後,假設您正確配置了緩存指令,瀏覽器應該將其緩存起來,因此後續的頁面加載看起來沒什麼區別。

使用像谷歌的PageSpeed插件或雅虎的YSlow工具來找出什麼是實際上導致性能問題,一旦你有大部分網站的到位,和優化重要的事情。在此之前不要擔心。

+0

這個答案是點亮的,但我想在這一點上揮動Firebug標誌。使用Firebug的Net選項卡,您可以獲得每一個資源的非常有用的分解,包括額外的DNS查找開銷的指示。在這裏獲取:https://addons.mozilla.org/en-US/firefox/addon/1843 – 2010-05-01 01:16:09

+0

是的。在知道主要影響因素之前,不要着手解決性能問題。這種特殊的差異是相當小的,但它會加起來超過幾百頁。 – 2010-05-01 01:21:13

+1

@David Foster:Google PageSpeed和Yahoo YSlow實際上是FireBug *的插件,所以我想我不會明確地提到FireBug本身,因爲我提到的那些覆蓋了這個,並且加載了更多關於加載時間問題的分析。 – Amber 2010-05-01 01:24:53