css 毛玻璃_html + css 毛玻璃特效

先看一下效果图

6e34c7788d7adbebe6405e95fcc61609.png

在看一下一下代码图

html:

001f6e16abb032e38c1525e6a686b477.png

css:

2956af0588ce5a8e05daa225005724e0.png

完整demo ,我们用的是filter:blur() 里面指越大模糊程度越大

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.bg {
width: 100%;
height: 500px;
position: relative;
overflow: hidden;
}
.bg::before {
content: "";
position: absolute;
/* 固定模糊层位置 */
width: 215%;
height: 200%;
left: -118%;
/* 回调模糊层位置 */
top: -102%;
/* 回调模糊层位置 */
background: url(../img/1.png) repeat fixed;
filter: blur(20px);
/* 值越大越模糊 */
z-index: 16;
}
/* .rgba {
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.2);
z-index: -1;
}
*/
.content {
width: 200px;
height: 100px;
background-color: yellow;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 999;
}
</style>
</head>
<body>
<div class="bg">
<div class="rgba"></div>
<div class='content'>
<p>hello 毛玻璃</p>
</div>
</div>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值