简约大气的登录界面,记录下来方便下次使用!

今天写了一个登录界面,现在记录下来方便以后使用!

首先是样式文件(Login.css):

*{
    margin:0px; padding:0px;
}

a{
    text-decoration:none;
}

body{
    background:#024aa3 url("images/loginBg.png") no-repeat;
    background-size:cover;
    background-repeat:no-repeat;
}

#loginWraper {
    position:fixed;
    top:50%;
    left:50%;
    margin-left:-250px;
    margin-top:-150px;
    width:500px;
    height:350px;
    background:url(images/loginWraper.png);
}

#title{
    width:80%;
    height:45px;
    margin:10px auto;
    line-height:45px;
    text-align:center;
    font-size:30px;
    font-family:YouYuan;
    font-weight:bold;
    color:white;
}

#content, #action, #loginConfirm{
    margin-top:15px;
}

#content table tr td, #loginConfirm table tr td{
    height:50px;
}

#content label{
    color:white;
    font-weight:bold;
    font-family:YouYuan;
    letter-spacing:1px;
    font-size:14px;
    height:30px;
    margin-left:115px;
    margin-right:5px;
}

#studentNumber, #password, #validateCode{
    color:white;
    width:200px;
    height:30px;
    border-radius:5px;
    padding-left:5px;
    letter-spacing:0.5px;
    font-size:14px;
    background-color:rgba(255, 255, 255, 0.40);
    border:0px;
    /*border:2px solid rgba(0, 215, 237, 1.00);*/
}

#validateCode{
    width:200px;
}

#studentNumber:focus, #password:focus, #validateCode:focus{
    border:0px;
    /*border:2px solid #00a3f6;*/
    outline:none;
}

#code{
    float:right;
    margin-right:5px;
    height:30px;
}

#rememberPw{
    margin-left:135px;
    width:13px;
    height:13px;
    vertical-align:middle;
}

#action label{
    color:white;
    font-weight:bold;
    font-family:YouYuan;
    font-size:13px;
    margin-left:0px;
}

#confirm{
    margin-left:115px;
    border:1px solid #FF9A14;
    background-color:#FF9A14;
    width:270px;
    height:30px;
    color:white;
    border-radius:5px;
    font-weight:bold;
    font-family:YouYuan;
    font-size:14px;
}

#confirm:hover{
    border:1px solid #E36709;
    background-color:#E36709;
    outline:none;
}

接着的就是页面布局的html文件(login.html):

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" charset="utf-8" />
    <title>登录</title>
    <link href="Login.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <!-- 登录界面 -->
    <div id="loginWraper">
        <div id="title">学生学籍管理系统</div>
        <form id="login_fm" method="post">
            <div id="content">
                <table>
                    <tr>
                        <td><label>学 号:</label></td>
                        <td><input id="studentNumber" name="studentNumber" type="text" placeholder="学 号" /></td>
                    </tr>
                    <tr>
                        <td><label>密 码:</label></td>
                        <td><input id="password" name="password" type="password" placeholder="密 码" /></td>
                    </tr>
                    <tr>
                        <td><label>验证码:</label></td>
                        <td>
                            <input id="validateCode" name="validateCode" type="text" placeholder="验证码" />
                        </td>
                    </tr>
                </table>
            </div>
            <div id="action">
				<input id="rememberPw" name="rememberPw" type="checkbox" checked="checked" />
				<label for="rememberPw">让我记住本次登录状态</label>
            </div>
        </form>
        <div id="loginConfirm">
            <table>
                <tr>
                    <td><button id="confirm" onclick="userLogin()">登 录</button></td>
                </tr>
            </table>
        </div>
    </div>
</body>
</html>

代码就这些,当然了,不能落下最终的效果截图:

代码demo实例下载地址:

登录界面demo代码

个人博客本文文章地址:奕独客博客-简约大气登录界面

  • 3
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是一个简单的示例,使用 Flask 作为后台框架,Ajax 实现异步提交表单,HTML 和 Bootstrap 实现页面布局和样式。 首先,创建一个 Flask 应用,设置路由和视图函数。 ```python from flask import Flask, render_template, request, jsonify app = Flask(__name__) @app.route('/') def index(): return render_template('login.html') @app.route('/login', methods=['POST']) def login(): username = request.form['username'] password = request.form['password'] if username == 'admin' and password == '123456': return jsonify({'success': True}) else: return jsonify({'success': False, 'message': '用户名或密码错误'}) ``` 然后,创建一个 HTML 文件,包含登录表单和 Ajax 提交代码。 ```html <!DOCTYPE html> <html> <head> <title>后台登录</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/4.6.0/css/bootstrap.min.css"> </head> <body> <div class="container"> <div class="row justify-content-md-center mt-5"> <div class="col-md-6"> <h3 class="text-center mb-4">后台登录</h3> <form id="login-form"> <div class="form-group"> <label for="username">用户名</label> <input type="text" class="form-control" id="username" name="username" required> </div> <div class="form-group"> <label for="password">密码</label> <input type="password" class="form-control" id="password" name="password" required> </div> <button type="submit" class="btn btn-primary btn-block">登录</button> </form> </div> </div> </div> <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script> <script> $(function() { $('#login-form').submit(function(event) { event.preventDefault(); $.ajax({ url: '/login', type: 'POST', data: $(this).serialize(), dataType: 'json', success: function(data) { if (data.success) { window.location.href = '/dashboard'; } else { alert(data.message); } }, error: function() { alert('登录失败,请重试'); } }); }); }); </script> </body> </html> ``` 最后,启动应用并访问 http://localhost:5000/ 即可看到登录界面。 注意:这只是一个简单的示例,实际应用中需要做更多的安全处理,比如密码加密、防止 CSRF 攻击等。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值