一行代码将网页变成灰色

一行代码将网页变成灰色

<style type="text/css">
	html, img {
      
      /* 灰度滤镜 */
		filter: grayscale(100%);
		-webkit-filter: grayscale(100%);
		-moz-filter: grayscale(100%);
		-ms-filter: grayscale(100%);
		-o-filter: grayscale(100%);
		filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
		-webkit-filter: grayscale(1);
		}
</style>

CSS3 filter(滤镜) 属性
Filter 函数
注意: 滤镜通常使用百分比 (如:75%), 当然也可以使用小数来表示 (如:0.75)。

grayscale(%)
将图像转换为灰度图像。值定义转换的比例。值为100%则完全转为灰度图像,值为0%图像无变化。值在0%到100%之间,则是效果的线性乘子。若未设置,值默认是0;

-webkit-filter: grayscale(100%) : 这个样式是专属于使用 webkit 内核的浏览器的,webkit内核的浏览器有谷歌浏览器、Safari浏览器、搜狗高速浏览器等。

-moz代表firefox浏览器私有属性

-ms代表ie浏览器私有属性(360浏览器是ie内核)

-webkit代表safari、chrome私有属性

-o代表opera私有属性

猜你喜欢

转载自blog.csdn.net/qq_38689263/article/details/128136809