CSS设定图片变灰色_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:37:47
Original
1596 people have browsed it


       在最近工作中,开发过程中需要设定一个图片变为灰色,刚开始我以为是更换图片,可是做了一段时间发现CSS就可以设定图片颜色变回灰色。具体的代码如下:

图片如下:


具体的实现由两种方法:一个是CSS3的滤镜功能。具体代码如下:

<span style="font-size:18px;">.gray {      -webkit-filter: grayscale(100%);     -moz-filter: grayscale(100%);     -ms-filter: grayscale(100%);     -o-filter: grayscale(100%);          filter: grayscale(100%); 	     filter: gray; }</span>
Copy after login

    只要把上面代码拷过去,设定成你想修改的图片样式就可以了。例如

<img  src="1.jpg" alt="CSS设定图片变灰色_html/css_WEB-ITnose" > <img  src="1.jpg" class="gray" alt="CSS设定图片变灰色_html/css_WEB-ITnose" >
Copy after login

  


版权声明:本文为博主原创文章,未经博主允许不得转载。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!