一个好看的登陆源码

一个好看的登陆模板,有账户密码验证。
在这里插入图片描述
在这里插入图片描述
再输入正确的账户密码之后就会跳转到指定页面。
HTML部分:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <link rel="stylesheet" href="./css/login.css">
</head>
<body>
        <div id="login-box">
            <h1>登录</h1>
            <div class="form">
                <div class="item">
                    <input type="text" placeholder="username" name="username" id="username">
                </div>
                <div class="item">
                    <input type="password" placeholder="password" name="password" id="password">
                </div>
            </div>
            <button type="submit" name="login" id="login">Login</button>
        </div>
</body>
</html>

css部分:

body {
    background: url("../img/background.png") center no-repeat;
    background-size:cover;  /* 让背景图基于容器大小伸缩 */
    background-attachment:fixed;        /* 当内容高度大于图片高度时,背景图像的位置相对于viewport固定 */    //此条属性必须设置否则可能无效/
    background-color:#CCCCCC;;
}

#login-box {
    width: 30%;
    height: auto;
    margin: 0 auto;
    margin-top: 15%;
    text-align: center;
    background: #00000080;
    padding: 20px 50px;
    border-radius: 20px;
}

#login-box h1 {
    color: white;

}

#login-box .form .item {
    margin-top: 15px;
}

#login-box .form .item input {
    width: 180px;
    font-size: 18px;
    border: 0;
    border-bottom: 3px solid white;
    padding: 5px 10px;
    background: #ffffff00;
    color: #ffffff;
}

#login-box .form .item input[placeholder] {
    color: white;
}

#login-box .form .item i {
    font-size: 18px;
    color: white;
}

#login-box button {
    border: 0;
    margin-top: 15px;
    width: 125px;
    height: 30px;
    font-size: 20px;
    font-weight: 700;
    color: white;
    background-image: linear-gradient(to right, #00dbde 0%, #fc00ff 100%);
    border-radius: 15px;
}

#message-box {
    color: white;
    position: fixed;
    bottom: 0px;
    width: 100%;
    text-align: center;
}

JS部分:

document.getElementById('login').addEventListener('click',function() {
                 var username = document.getElementById('username');
   	 var password = document.getElementById('password');
 	   if (username.value == "") {
 	       alert("请输入用户名");
	    } else if (password.value  =="") {
	        alert("请输入密码");
	    } else if(username.value == "admin" && password.value == "123456"){
	       window.location.href='https://www.baidu.com/';
	    } else {
	        alert("请输入正确的用户名和密码!")
 	   }
	})

点我下载

昨天很重要,它构建了我们的记忆;明天很重要,它让我们有了憧憬和梦想。

  • 4
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
抱歉,作为AI语言模型,我无法为您呈现图片或网页界面,但我可以为您提供一个基本的XHTML代码示例,您可以在此基础上进一步美化您的录界面: ```html <!DOCTYPE html> <html> <head> <title>录界面</title> <style type="text/css"> body { background-color: #f2f2f2; font-family: Arial, sans-serif; } .container { margin: 100px auto; padding: 20px; background-color: #ffffff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); border-radius: 5px; } h1 { text-align: center; margin-top: 0; color: #333333; } label { display: block; margin-bottom: 5px; color: #333333; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; border: none; border-radius: 5px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24); margin-bottom: 10px; font-size: 16px; } input[type="submit"] { background-color: #008CBA; color: #ffffff; padding: 10px 20px; border: none; border-radius: 5px; font-size: 16px; cursor: pointer; } </style> </head> <body> <div class="container"> <h1>录</h1> <form action="#" method="post"> <label for="username">用户名</label> <input type="text" id="username" name="username" required> <label for="password">密码</label> <input type="password" id="password" name="password" required> <input type="submit" value="录"> </form> </div> </body> </html> ``` 这是一个简单的录界面,包含一个标题、两个输入框和一个提交按钮。您可以根据需要修改样式、添加图标等等,以获得更美观的效果。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值