CSS使图片变灰
时间:2021-07-01 10:21:17
帮助过:20人阅读
为了悼念,各大网站都纷纷将自己的站点颜色调灰,就连图片也一样,到底如何实现的呢,请看下面的代码。
〈img src="http://hovertree.com/hvtimg/201512/f748s0ko.jpg" style="filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)" onmouseover="this.style.filter='progid:DXImageTransform.Microsoft.BasicImage(grayscale=0)'" onmouseout="this.style.filter='progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)'">
变灰:style= "filter:progid:DXImageTransform.Microsoft.BasicImage(grayScale=1); "
如果想让整个网站的图片变灰,在样式表中加入
img{filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);}
按纽变灰
INPUT { border:1px solid #999; filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);}
推荐:http://www.cnblogs.com/roucheng/p/texiao.html