实现一个登录html
时间: 2023-07-13 18:10:45 浏览: 33
好的,以下是一个简单的登录页面的 HTML 代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>用户登录</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
}
form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 8px;
margin: 5px 0;
border: 1px solid #ccc;
border-radius: 3px;
box-sizing: border-box;
}
input[type="submit"] {
background-color: #4CAF50;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 3px;
cursor: pointer;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<form action="login.php" method="post">
<h2>用户登录</h2>
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required><br>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required><br>
<input type="submit" value="登录">
</form>
</body>
</html>
```
这个页面包含一个表单,包括用户名和密码两个输入框,以及一个提交按钮。在样式方面,使用了一些基本的 CSS 规则,使页面看起来更加美观和易于使用。在表单的 `action` 属性中,可以将其设置为实际的 URL,以便将表单数据提交到服务器进行处理。