一个简单的CSS登录页

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>loginPage</title>
    <style>
        html{
            height: 100%;
        }
        body{
            background-image: linear-gradient(to top, #330867 0%, #30cfd0 100%);
            margin: 0;      
            }
        h2{
            text-align: center;
            color: white;
        }
        .box{
            width: 400px;
            height: 320px;
            background-color: black;
            border-radius: 10px;
            margin: 0 auto;
            margin-top: 10%;
            padding: 30px;
            opacity: 0.7;
        }
        .item{
            height: 45px;
            width: 100%;
            color: #03e9f4;
            border-bottom: 1px solid #fff;
            margin-bottom: 40px;
            position: relative;
        }        
        .item input{
            width: 100%;
            height: 100%;
            color: white;
        }
        .item input:focus+label,.item input:valid+label{
            top: 0;
            font-size: 12px;
            color: white;
        }
        .item label{
            position: absolute;
            left: 0;
            top: 12px;
            transition: all 0.3s linear;
        }
        .btn{
            width: 100px;
            height: 40px;
            border: 1px solid white;
            border-radius: 10px;
            color: #03e9f4;
            padding: 10px 20px;
            margin-left: 150px;
            margin-top: 15px;
        }
        .btn:hover{
            background-color: #03e9f4;
            color: white;
            box-shadow: 0 0 5px 0 #03e9f4,
                        0 0 25px 0 #03e9f4,
                        0 0 50px 0 #03e9f4,
                        0 0 100px 0 #03e9f4;
            text-transform: uppercase;
            
        }
        input,button{
            width: 100%;
            height: 100%;
            background-color: transparent;
            outline: none;
            border: none;
            padding-top: 20px;
            box-sizing: border-box;
        }
    </style>
</head>
<body>
    <div class="box">
        <h2>Login</h2>
        <form action="">
            <div class="item">
                <input type="text" required>
                <label>Username</label>
            </div>
            <div class="item">
                <input type="password" required>
                <label>Password</label>
            </div>
            <button class="btn">submit</button>
        </form>
    </div>

</body>
</html>

相关推荐