用html写一个登陆页面 包括用户名 密码 和登录按钮
时间: 2023-10-24 16:07:51 浏览: 27
当然可以!以下是一个简单的 HTML 登录页面示例:
```html
<!DOCTYPE html>
<html>
<head>
<title>登录页面</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f2f2f2;
text-align: center;
}
.container {
margin-top: 150px;
width: 300px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
display: inline-block;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
.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;
border-radius: 4px;
}
.container button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
border-radius: 4px;
}
.container button:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>登录</h2>
<form>
<label for="username">用户名:</label>
<br>
<input type="text" id="username" name="username" required>
<br>
<label for="password">密码:</label>
<br>
<input type="password" id="password" name="password" required>
<br><br>
<button type="submit">登录</button>
</form>
</div>
</body>
</html>
```
将上述代码保存为一个名为 `login.html` 的文件,然后在浏览器中打开该文件,你将看到一个包含用户名、密码和登录按钮的简单登录页面。