登录表单玻璃特效

**每天一个小案例:
第一天 (html+css)

登录表单玻璃特效

**
HTML部分

<div class="container">
        <form action="#" class="login-form">
            <h2>登录</h2>
            <input type="text" name="uaername" placeholder="用户名">
            <input type="password" name="password" placeholder="密码">
            <button type="button">登录</button>
        </form>
    </div>

CSS部分

<style>
        * {
            padding: 0;
            margin: 0;
        }
        
        .container {
            width: 100vw;
            height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            background: url(./img/bgc2.jpg) fixed no-repeat;
            block-size: cover;
        }
        
        .login-form {
            width: 240px;
            height: 220px;
            display: flex;
            padding: 40px;
            text-align: center;
            position: relative;
            flex-direction: column;
            background: inherit;
            /* 继承父级背景图值,随着图片背景变化 */
            z-index: 100;
            border-radius: 18px;
            overflow: hidden;
        }
        
        .login-form::before {
            content: "";
            width: calc(100% + 20px);
            height: calc(100% + 20px);
            background: inherit;
            box-shadow: inset 0 0 0 200px rgba(255, 255, 255, 0.25);
            position: absolute;
            top: -10px;
            left: -10px;
            z-index: -1;
            filter: blur(6px);
            overflow: hidden;
        }
        
        .login-form h2 {
            font-size: 18px;
            font-weight: 400;
            color: #000;
        }
        
        .login-form input,
        .login-form button {
            margin: 6px 0;
            height: 36px;
            border: none;
            background-color: rgba(255, 255, 255, 0.3);
            padding: 0 14px;
            color: #000;
            outline: none;
        }
        
        .login-form input::placeholder {
            color: gray;
        }
        
        .login-form button {
            margin-top: 24px;
            color: #fff;
            background-color: rgba(80, 80, 80, 0.4);
            cursor: pointer;
            overflow: hidden;
            position: relative;
            transition: 0.4s;
        }
        
        .login-form button:hover {
            background-color: rgba(80, 80, 80, 0.8);
        }
             /* 按钮特效 */
        .login-form button::before,
        .login-form button::after {
            content: "";
            display: block;
            width: 60px;
            height: 100%;
            background: rgba(179, 255, 210, 0.3);
            opacity: 0.5;
            position: absolute;
            left: 0px;
            top: 0;
            transform: skewX(-15deg);
            filter: blur(30px);
            overflow: hidden;
            transform: translateX(-100px);
        }
        
        .login-form button::after {
            width: 40px;
            background: rgba(94, 203, 223, 0.836);
            left: 60px;
            filter: blur(5px);
            opacity: 0;
        }
        
        .login-form button:hover:before {
            transition: 1s;
            transform: translateX(320px);
            opacity: 0.7;
        }
        
        .login-form button:hover::after {
            transition: 1s;
            transform: translateX(320px);
            opacity: 1;
        }
    </style>

在这里插入图片描述

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值