web中HTML登录页面代码
时间: 2023-12-08 08:38:15 浏览: 19
以下是一个简单的HTML登录页面代码示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h2>Login Form</h2>
<form>
<label for="username">Username:</label><br>
<input type="text" id="username" name="username"><br>
<label for="password">Password:</label><br>
<input type="password" id="password" name="password"><br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
```
这个示例包含一个标题,一个表单和一个提交按钮。表单包含两个输入字段:用户名和密码。当用户单击提交按钮时,表单将被提交到服务器进行处理。
相关问题
web登录界面html源代码
以下是一个简单的Web登录界面的HTML源代码示例:
```
<!DOCTYPE html>
<html>
<head>
<title>Login</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
form {
border: 3px solid #f1f1f1;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
button:hover {
opacity: 0.8;
}
.cancelbtn {
width: auto;
padding: 10px 18px;
background-color: #f44336;
}
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
}
img.avatar {
width: 40%;
border-radius: 50%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
@media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
.cancelbtn {
width: 100%;
}
}
</style>
</head>
<body>
<h2>Login Form</h2>
<form action="/action_page.php">
<div class="imgcontainer">
<img src="img_avatar2.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Username</b></label>
<input type="text" placeholder="Enter Username" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Remember me
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" class="cancelbtn">Cancel</button>
<span class="psw">Forgot <a href="#">password?</a></span>
</div>
</form>
</body>
</html>
```
此代码包含一个带有用户名和密码字段以及“登录”和“取消”按钮的表单,以及一个用于显示头像的图像容器。此外,它还包含一个用于记住登录信息的复选框和一个用于重置密码的链接。请注意,此代码仅用于示例目的,实际的Web登录界面可能需要更多功能和安全性措施。
web登录页面设计html代码
以下是一个简单的web登录页面的html代码示例:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Login</title>
<style>
body {
background-color: #f2f2f2;
}
.login-box {
width: 300px;
margin: 100px auto;
background-color: #fff;
border-radius: 5px;
padding: 20px;
box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: none;
box-shadow: 0 5px 10px rgba(0,0,0,0.1);
}
input[type="submit"] {
width: 100%;
background-color: #4CAF50;
color: #fff;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="login-box">
<h2>Login</h2>
<form action="" method="POST">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
</div>
</body>
</html>
```
这段代码创建了一个简单的登录页面,包含用户名和密码的输入框以及登录按钮。CSS样式用于设置页面的外观和布局。请注意,此代码中的表单未连接到后端,因此在实际使用中需要将其连接到后端代码中。