利用css滤镜效果把彩色变灰色

 分类:div+css教程时间:2015-11-01 14:52:03点击:

有时候想把网站上的图片全部变成灰色,要怎么做呢?这时就可以用到css中的滤镜效果啦,利用css滤镜效果把彩色变灰色,用一个html选择器来做,图片处理的前后效果如下:

css滤镜前的图片

css滤镜前

[caption id="attachment_76" align="aligncenter" width="300"]滤镜后的效果图 滤镜后的效果图[/caption]

css滤镜代码如下:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>滤镜效果</title>
<style type="text/css">
img{filter:gray;}
</style>
</head>
<body>
<img src="1.jpg" width="200" height="200"/>
<img src="2.jpg" width="200" height="200"/>
<img src="3.jpg" width="200" height="200"/>
<img src="4.jpg" width="200" height="200"/>
</body>

除注明外的文章,均为来源:老汤博客,转载请保留本文地址!
原文地址: