用 html 写一个登录页面
时间: 2023-08-31 15:34:55 浏览: 35
### 回答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:
HTML是一种标记语言,用于构建网页。我将为您提供一个简单的登录页面示例:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录页面</title>
<style>
body {
font-family: Arial, sans-serif;
}
.container {
width: 300px;
margin: 100px auto;
}
h2 {
text-align: center;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
margin-bottom: 10px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: white;
border: none;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>登录</h2>
<form action="/login" method="POST">
<input type="text" placeholder="用户名" name="username" required>
<input type="password" placeholder="密码" name="password" required>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
这个页面设置了一个登录表单,包含了用户名和密码的输入框以及一个提交按钮。用户可以在输入框中输入用户名和密码,然后点击登录按钮进行身份验证。在实际使用中,您需要将`action`属性指向实际的登录处理程序。此页面还包含了一些CSS样式来美化页面的外观。
### 回答3:
HTML是一种标记语言,可以用于创建网页。下面是一个使用HTML编写的简单登录页面的示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f1f1f1;
}
.container {
max-width: 380px;
margin: 0 auto;
padding: 20px;
background-color: white;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.container h2 {
text-align: center;
}
.container input[type="text"], .container input[type="password"] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
.container button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
}
</style>
</head>
<body>
<div class="container">
<h2>用户登录</h2>
<input type="text" placeholder="请输入用户名" name="username" required>
<input type="password" placeholder="请输入密码" name="password" required>
<button type="submit">登录</button>
</div>
</body>
</html>
```
这个登录页面包含一个标题"用户登录",一个文本输入框用于输入用户名,一个密码输入框用于输入密码,还有一个登录按钮。页面使用了简单的CSS样式,使其看起来更具吸引力和用户友好性。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)