CSS在被IE執行前必須先下載到Local端,
因此css程式碼越小的話越能結省下載時間。

CSS dirve這個網站,
提供了一個壓縮程式碼的網頁程式免費供大家使用。
使用方法很簡單,
只要將CSS程式碼複製貼上到網頁上,
然後選取想要的壓縮選項,
然後按「Compress-it」就開始壓縮了。


下面是網頁上擷錄過來的選項,
大部份都很容易懂,
我解釋一下Compress color codes where possible (?)這一項,
在CSS裡一個顏色的表示可以用#000000 ~ #ffffff來表示,
如果顏色剛好是#000000,其實可以用#000來表示就行了,
而顏色#ff8833可以簡寫成#f83,
這種簡寫方式,可以結省一些程式碼的所佔的大小,
也算是壓縮。

Spaces and tabs
Replace multiple spaces with just one space
Remove space around chars ;:{},
Leave space between selectors (?)
Leave space between properties (?)
Remove tabs

New lines handling
Leave lines as they are
Replace multiple empty lines with just one empty line
Remove all newlines

Comment handling (?)
Don't strip any comments
Strip ALL comments
Strip comments at least chars long

Other options
Compress color codes where possible (?)
Remove unnecessary semi-colons
One command per line (?)
arrow
arrow
    全站熱搜

    jck11 發表在 痞客邦 留言(3) 人氣()