你帮我写登入页面的代码
时间: 2024-05-10 11:16:30 浏览: 46
好的,我可以为您提供一些关于登入页面的代码,以下是一个基本的登入页面HTML代码:
```
<!doctype html>
<html>
<head>
<title>登入页面</title>
</head>
<body>
<h2>欢迎来到我的网站!</h2>
<form action="#" method="post">
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required><br><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required><br><br>
<input type="submit" value="登入">
</form>
</body>
</html>
```
以上代码包括一个简单的表单,用户需要在该表单中输入用户名和密码才能成功登入。当然,此代码只是提供了一个基础框架,您需要进一步处理用户输入和对用户进行身份验证的逻辑部分来实现完整的登入系统。
相关问题
登入页面代码
以下是一个简单的登陆页面的 HTML 和 CSS 代码示例:
HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>登陆页面</title>
<link rel="stylesheet" href="login.css">
</head>
<body>
<div class="login-container">
<h1>登陆</h1>
<form>
<label for="username">用户名</label>
<input type="text" id="username" name="username" placeholder="请输入用户名">
<label for="password">密码</label>
<input type="password" id="password" name="password" placeholder="请输入密码">
<input type="submit" value="登陆">
</form>
</div>
</body>
</html>
```
CSS 代码:
```css
.login-container {
width: 300px;
margin: 0 auto;
text-align: center;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
margin-top: 50px;
}
h1 {
font-size: 24px;
margin-bottom: 20px;
}
form {
display: flex;
flex-direction: column;
}
label {
font-size: 16px;
margin-bottom: 5px;
text-align: left;
}
input[type="text"],
input[type="password"] {
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: 1px solid #ccc;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px;
border-radius: 5px;
border: none;
cursor: pointer;
font-size: 16px;
}
```
以上代码可以作为一个基础的登陆页面模板,您可以根据自己的需求进行修改和美化。
我要一个用html5、css3、js写成的登入页面代码
非常感谢您的问题,以下是一个简单的使用 HTML5、CSS3 和 JavaScript 编写的登录页面代码示例:
HTML5 代码:
```
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录页面</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="login-box">
<h2>登录</h2>
<form>
<div class="user-box">
<input type="text" name="username" required="">
<label>用户名</label>
</div>
<div class="user-box">
<input type="password" name="password" required="">
<label>密码</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
提交
</a>
</form>
</div>
</body>
</html>
```
CSS3 代码:
```
* {
margin: ;
padding: ;
box-sizing: border-box;
}
body {
font-family: sans-serif;
background: #34495e;
}
.login-box {
width: 280px;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #191919;
padding: 40px;
border-radius: 10px;
box-shadow: 20px rgba(, , , .2);
}
.login-box h2 {
color: #fff;
text-align: center;
margin-bottom: 30px;
}
.login-box .user-box {
position: relative;
}
.login-box .user-box input {
width: 100%;
padding: 10px ;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.login-box .user-box label {
position: absolute;
top: ;
left: ;
padding: 10px ;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
top: -20px;
left: ;
color: #03a9f4;
font-size: 12px;
}
.login-box a {
display: inline-block;
background: #03a9f4;
color: #fff;
padding: 10px 20px;
font-size: 16px;
border-radius: 5px;
text-decoration: none;
transition: .5s;
margin-top: 40px;
}
.login-box a:hover {
background: #fff;
color: #03a9f4;
}
```
JavaScript 代码:
```
const inputs = document.querySelectorAll(".user-box input");
function focusFunc() {
let parent = this.parentNode;
parent.classList.add("focus");
}
function blurFunc() {
let parent = this.parentNode;
if (this.value == "") {
parent.classList.remove("focus");
}
}
inputs.forEach(input => {
input.addEventListener("focus", focusFunc);
input.addEventListener("blur", blurFunc);
});
```
希望这个示例对您有所帮助!
阅读全文
相关推荐
















