![](https://csdnimg.cn/release/download_crawler_static/89429260/bg1.jpg)
创建一个简单的 HTML 登录页面代码可以如下所示。请注意,HTML 本身只负责页面的结构和内容,并不
处理登录验证。通常,你会使用 JavaScript(前端)或服务器端语言(如 PHP、Python、Node.js 等)来处
理用户提交的登录信息。
以下是一个简单的 HTML 登录页面代码:
html 复制代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<style>
/* 简单的样式,使页面更易于阅读 */
body {
font-family: Arial, sans-serif;
padding: 20px;
}
.container {
max-width: 300px;
margin: 0 auto;
}
label, input[type="text"], input[type="password"] {
display: block;
margin-bottom: 10px;
}
input[type="submit"] {
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container">
<h2>Login</h2>
<form action="/login" method="post"> <!-- 注意:这里的 action 属性应该指向你的登
录处理脚本 -->
<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">