页面变成黑白的CSS代码

 1 <style>
 2     html
 3     {
 4         filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale"); /* Firefox 3.5+ */
 5         -webkit-filter: grayscale(100%); /* chrome+ */
 6         filter: grayscale(100%); /* 未来浏览器 */
 7         filter: gray; /* ie7-9 */
 8         filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); /*ie7-9 */
 9     }
10 </style>

把这段代码加上需要的页面上就好了。注:IE6不支持

原文地址:https://www.cnblogs.com/evasunny/p/3046476.html