html+css精致的登录页面 (含源码的哦)

1.首先是登录页面效果展示

 

2.代码如下

<!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>Login</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        body{
            /* 页面的透明图 0-1 */
            opacity: 0.8;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 100vh;
            /* 页面的背景图片,可以修改 */
            background:url(img/4.jpg) ;
            background-size: cover;

        }
        .box{
            border-radius: 20px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            height: 380px;
            width: 350px;
            border-top: 1px solid rgba(255, 255, 255, 0.5);
            border-left: 1px solid rgba(255, 255, 255, 0.5);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            border-right: 1px solid rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            background: rgba(255, 255, 255, 0.2);
        }
        .box h2{
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 20px;
        }
        .box .input-box{
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: start;
            margin-bottom: 10px;
        }
        .box .input-box label{
            margin-bottom: 5px;
            color: rgba(255, 255, 255, 0.9);
            font-size: 13px;
        }
        .box .input-box input{
            box-sizing: border-box;
            color: rgba(255, 255, 255, 0.9);
            font-size: 14px;
            height: 35px;
            width: 250px;
            background:rgba(255, 255, 255, 0.3);
            border: 1px solid rgba(255, 255, 255, 0.5);
            border-radius: 5px;
            transition: 0.2s;
            outline: none;
            padding: 0 10px;
            letter-spacing: 1px;
        }
        .box .input-box input:focus{
            border: 1px solid rgba(255, 255, 255, 0.8);
        }
        .box .btn-box {
            width: 250px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: start;
        }
        .box .btn-box a{
            font-size: 13px;
            width: 250px;
            text-align: end;
            text-decoration: none;
            color: rgba(255, 255, 255, 0.9);
            transition: 0.2s;
        }
        .box .btn-box a:hover{
            color: rgba(255, 255, 255, 1);

        }
        .box .btn-box div{
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: start;
            margin-top: 20px;
        }
        .box .btn-box div button{
            width: 115px;
            height: 35px;
            border: 1px solid rgba(197, 81, 58, 0.8);
            background: rgba(197, 81, 58, 0.5);
            color: rgba(255, 255, 255, 0.9);
            border-radius: 5px;
            transition: 0.2s;
        }
        .box .btn-box div button:nth-of-type(2){
            margin-left: 10px;
        }
        .box .btn-box div button:hover{
            border: 1px solid rgba(248, 108, 76, 0.8);
            background: rgba(248, 108, 76, 0.5);
        }
    </style>
</head>
<body>
    <div class="box">
        <h2>Login</h2>
        <div class="input-box">
            <label for="">账号</label>
            <input type="text">
        </div>
        <div class="input-box">
            <label for="">密码</label>
            <input type="password">
        </div>
        <div class="btn-box">
            <a href="#">忘记密码?</a>
            <div>
                <button alert="确定登录?">登录</button>
                <button>注册</button>
            </div>
        </div>
    </div>
    
</body>
</html>

背景图片是可以随便修改的,你只需要建立一个img文件夹,把背景图片放进去就好

  • 12
    点赞
  • 115
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
以下是一个简单但精致HTML5和CSS登录页面的示例: ```html <!DOCTYPE html> <html> <head> <title>Login Page</title> <link rel="stylesheet" type="text/css" href="login.css"> </head> <body> <div class="login-container"> <h2>Login</h2> <form> <label for="username">Username:</label> <input type="text" id="username" name="username" required><br><br> <label for="password">Password:</label> <input type="password" id="password" name="password" required><br><br> <input type="submit" value="Login"> </form> </div> </body> </html> ``` ```css body { background: #f5f5f5; font-family: Arial, sans-serif; } .login-container { background: #fff; margin: 50px auto; padding: 30px; border-radius: 5px; box-shadow: 0 0 5px rgba(0,0,0,0.3); max-width: 400px; } h2 { text-align: center; margin-bottom: 30px; } form label { display: block; margin-bottom: 10px; } form input[type="text"], form input[type="password"] { padding: 10px; border: none; border-radius: 5px; box-shadow: 0 0 5px rgba(0,0,0,0.1); width: 100%; margin-bottom: 20px; } form input[type="submit"] { background: #0077cc; color: #fff; border: none; border-radius: 5px; padding: 10px 20px; cursor: pointer; font-size: 16px; transition: background 0.3s ease; } form input[type="submit"]:hover { background: #0062a3; } ``` 这个页面使用了一个简单的CSS样式表来美化页面。它使用了一个包登录表单的容器元素,并将其居中对齐。标签和输入字段都有适当的样式,以使它们更加美观。提交按钮也有一个简单的动画效果,在鼠标悬停时会改变颜色。 你可以根据自己的需求进一步修改和扩展这个页面。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值