DropShadow 屬性
DropShadow 用來替物件加上陰影,效果看起來就像把原本的物件稍微移開,然後在頁面上留下它的投影。表達式如下:
Filter: DropShadow(Color=color, Offx=Offx, Offy=offy, Positive=positive)
四個參數分別是:Color 代表陰影顏色;Offx 與 Offy 分別是 X、Y 方向的偏移量,必須用整數設定,正值代表向右與向下,負值則相反;Positive 有兩個值,True 為任何非透明像素建立可見投影,False 為透明像素部分建立投影。

看,圖中的文字像是從頁面上浮起來,還留下一層淡淡的影子。實際使用的程式碼如下:
<html>
<head>
<title>dropshadow</title>
<style>
<!--
div {
position: absolute;
top: 20px;
width: 300px;
filter: dropshadow(color=#FFCCFF, offx=15, offy=10, positive=1);
}
/* 定義 DIV 範圍內的樣式:絕對定位,陰影顏色 #FFCCFF,
投影向右偏移 15 像素、向下偏移 10 像素 */
-->
</style>
</head>
<body>
<div>
<p style="font-family: matisse itc; font-size: 64px;
font-weight: bold; color: #CC00CC;">
/* 定義字體名稱、大小、粗細、顏色 */
Love Leaf</p>
</div>
</body>
</html>
與 Chroma 一樣,DropShadow 對圖像的支援並不理想,特別是 JPEG、GIF 這類格式。原因也相同:這類圖像顏色變化豐富,很難找到一個乾淨的位置來投射陰影。
Chroma 屬性
Chroma 可以把物件中指定的顏色設為透明。表達式非常單純:
Filter: Chroma(color=color)
只有一個參數,把想要透明的顏色填進去即可。看看下面這張圖:

圖中有兩種字體、兩種顏色。我們對「leaves」這個綠色字體套用 chroma 讓它透明,程式碼如下:
<html>
<head>
<title>chroma filter</title>
<style>
<!--
div { position: absolute; top: 70px; width: 200px;
filter: chroma(color=green) }
/* 定義 DIV 範圍內綠色為透明色,另外設定 DIV 的位置 */
p { font-family: bailey; font-size: 48px; font-weight: bold; color: green }
/* 設定 P 的字體名稱、大小、粗細、顏色 */
em { font-family: lucida handwriting italic; font-size: 48px;
font-weight: bold; color: rgb(255,51,153) }
/* 設定 EM 的字體名稱、大小、粗細、顏色 */
-->
</style>
</head>
<body>
<div>
<p>LEAVES <em>LOVE</em></p>
</div>
</body>
</html>
透過上述設定使綠色透明,顯示效果如下:

綠色的 leaves 字體不見了——其實它只是變成透明。在 IE 下點擊它原本所在的區域,它還是会重新顯示出來:

另外要注意,chroma 屬性並不適合處理圖片檔。因為許多圖片經過減色與壓縮(如 JPG、GIF),很難找到固定單一的顏色可以設為透明,邊緣容易出現殘留的色塊。
blur 屬性
blur 也可以套用在字體上。把 blur 的 add 參數設為 1,得到的文字效果如下:

是不是有點印象派的味道?實現代碼如下:
<html>
<head>
<title>filter blur</title>
<style>
<!--
div { width: 200px;
filter: blur(add=true, direction=90, strength=25); }
/* 設定 DIV 樣式,套用 blur 濾鏡屬性 */
-->
</style>
</head>
<body>
<div style="width:702px; height: 288px">
<p style="font-family: lucida handwriting italic; font-size: 72px;
font-weight: bold; color: rgb(55,72,145);">
/* 定義字體名稱、大小、樣式、前景色 */
LEAF</p>
</div>
</body>
</html>
這裡 strength 設為 25。如果把數值再加大,就會得到非常誇張的效果;同時把 direction 改成 180,呈現又是另一種風貌:

用 blur 設定字體能玩出很多變化,只要再微調 direction 與 strength 的組合,效果就會跟著改變,值得自己動手試一試。