用 html 写一个登录页面
时间: 2023-08-31 08:29:04 浏览: 55
### 回答1:
Here's an example of a simple HTML login page:
```
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<h1>Login</h1>
<form action="">
<label for="username">Username:</label>
<input type="text" id="username" name="username">
<br><br>
<label for="password">Password:</label>
<input type="password" id="password" name="password">
<br><br>
<input type="submit" value="Submit">
</form>
</body>
</html>
```
### 回答2:
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f1f1f1;
}
.container {
width: 300px;
margin: 0 auto;
padding: 20px;
background-color: white;
border: 1px solid #ccc;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 8px;
font-size: 16px;
border: 1px solid #ccc;
border-radius: 4px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
font-size: 16px;
color: white;
background-color: #4caf50;
border: none;
border-radius: 4px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>登录页面</h2>
<form>
<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>
### 回答3:
HTML是一种用于构建网页的标记语言,可以用它编写登录页面。下面是一个用HTML编写的基本登录页面的示例:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录页面</title>
</head>
<body>
<h1>用户登录</h1>
<form>
<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="登录">
<input type="reset" value="重置">
</form>
</body>
</html>
```
上面的代码创建了一个标题为"用户登录"的登录页面。页面包含一个表单,用户可以输入用户名和密码。表单中有两个必填项:用户名和密码。输入框的类型分别为"text"和"password",密码框会遮盖用户输入的内容。还有两个按钮,一个用于提交登录信息,另一个用于重置输入的内容。
这只是一个简单的登录页面示例,实际应用中还需要添加其他功能,例如验证用户输入、连接数据库等。