15872424121 在线客服 返回顶部
最新案例 技术分享

CSS怎么使网页全部变成灰色

2016-10-13分享

Desaturating a color image couldn’t be simpler with CSS3. We’ll apply the filter as a class, as you’d typically desire several images to be affected by the code at the same time:

img.desaturate { filter: grayscale(100%); }

Naturally, all current browsers implement CSS3 filters via vendor prefixes, so our first job is to insert that code, writing in CSS that does not yet exist in order to future-proof our work:

img.desaturate { filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
filter: grayscale(100%);
}

Applying the class to the image is easy:

在线咨询
Copyright © 2006-2019 黎明网络 版权所有 鄂ICP备14015779号 武汉网站建设 武汉专业网站建设公司
电话:158 7242 4121(武昌|汉口|汉阳) E-mail:402690268@qq.com 地址:武汉市武昌区汉街总部国际F-16楼