把整个页面变得灰色沉重

记录了一个把整个页面变得沉重的代码



一 代码

<head>
	<style>
	   html{
		filter: progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
		-webkit-filter: grayscale(100%);
		}
	  .container{
		text-align: center;
		}
	  img{
		width: 1000px;
		height: 800px;
		}
	</style>
</head>
<body>
	<div class="container">
	   <img src="fengjing.jpg"/>
	</div>
</body>

二 效果

在这里插入图片描述

三 解析

filter 属性定义了元素(通常是<img>)的可视效果(例如:模糊与饱和度)。

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

四 总结

   如有错误恳请指正,如有侵权请联系我删除

猜你喜欢

转载自blog.csdn.net/qq_39007083/article/details/105324386