标题很虚,下图也很虚!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>图片虚化</title>
<style>
.img-box{display: flex;flex-direction: column;overflow: hidden;}
.img-box>span{display: block;width: 100%;font-size: 16px;font-weight: bold;color: #666;text-indent: 1em;}
.img-box>img{display: block;max-width: 48%;margin: 10px;}
img:nth-last-child(1){filter:blur(10px) contrast(.8);}
</style>
</head>
<body>
<div class="img-box">
<span>虚化之前:</span>
<img src="./001.png" />
<span>虚化之后:</span>
<img src="./001.png" />
</div>
</body>
</html>
这个虚化又名”高斯模糊“,实现代码如下:
filter:blur(”模糊的半径0|px|rem“) contrast(”透明度0~1“)
是吧,要多虚有多虚~