图片局部模糊

html文件

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录表单玻璃特效</title>
    <link rel="stylesheet" href="./index.css">
</head>
<body>
<div class="box">
    <form action="#" class="login_form">
        <h2>登录</h2>
        <input type="text" name="username" required="required" placeholder="用户名">
        <input type="password" name="pwd" required="required" placeholder="密码">
        <button type="submit">LOGIN</button>
    </form>
</div>
    
</body>
</html>

CSS文件

html,
body{
    margin: 0;
    padding: 0;
}
.box{
    display: flex;
    height: 100vh;
    width: 100vw;
    justify-content: center;
    align-items: center;
    background: url(./image/login.jpg) fixed no-repeat;
    background-size: cover;
}
.login_form{
    display: flex;
    position: relative;
    width: 240px;
    height: 220px;
    /* 将元素纵向展示 */
    flex-direction: column;
    padding: 40px;
    text-align: center;
    /* 继承父元素的属性 */
    background: inherit;
    border-radius: 18px;
    overflow: hidden;
    z-index: 100;
}
/* 背景图片局部模糊模糊区域 */
.login_form::after{
    content: "";
    position: absolute;
    top:-10px;
    left: -10px;
    width: calc(100% + 20px);
    height:calc(100% + 20px);
    border-radius: inherit;
    box-shadow:inset 0 0 0 6px rgba(255,255,255,.25); 
    background: inherit;
    z-index: -1;
    filter: blur(6px);
    overflow: hidden;
}
.login_form h2{
    font-size: 18px;
    font-weight:400;
    color: #3d5245;
}
.login_form input,
.login_form button{
    margin: 6px 0;
    height: 30px;
    border: none;
    border-radius: 4px;
    background-color: rgba(255,255,255,.3);
    color: #3d5245;
    outline: none;
}
.login_form input::placeholder{
    color: #3d5245;
}
.login_form button{
    /* position: relative; */
    margin-top: 24px;
    background-color: rgba(41, 124, 73, 0.2);
    color: white;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.6s;
    
}
.login_form button:hover{
    background-color: rgba(41, 124, 73, 0.5);
}

预览链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值