當(dāng)前位置:軟件學(xué)堂 > 資訊首頁 > 網(wǎng)絡(luò)編程 > DIV+CSS > CSS濾鏡gray屬性(灰度處理)

CSS濾鏡gray屬性(灰度處理)

2012/11/25 16:47:12作者:佚名來源:網(wǎng)絡(luò)

移動(dòng)端

【實(shí)例介紹】

CSS濾鏡gray屬性(灰度處理)

使用gray濾鏡可以把一張圖片變成灰度圖。

【基本語法】

filter:gray

【語法介紹】

灰度不需要設(shè)置參數(shù),它去除目標(biāo)的所有色彩,將其以灰度級(jí)別顯示。

【實(shí)例代碼】

<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>無標(biāo)題文檔</title> </head> <style type="text/css"> .p {  filter: Gray;} </style> </head> <body> <table width="324" height="194" border="0" align="center" cellpadding="5" cellspacing="5">   <tr>     <td align="center" >原圖</td>     <td align="center" >灰度處理效果</td>   </tr>   <tr> <td width="150" height="179" ><img src="6.jpg" width="360" height="360" /></td> <td width="150" class="p"><img src="6.jpg" width="360" height="360" /></td>   </tr> </table> </body> </html>

【代碼分析】

在代碼中,filter:gray標(biāo)簽用來設(shè)置灰度處理,在瀏覽器中預(yù)覽效果,如圖所示。

灰度處理gray運(yùn)行效果

 【素材及源碼下載】

請(qǐng)點(diǎn)擊:CSS濾鏡gray屬性(灰度處理) 下載本實(shí)例相關(guān)素材及源碼

 

標(biāo)簽: CSS濾鏡  gray屬性