用html 写一个登陆页面
时间: 2023-05-22 14:06:25 浏览: 77
好的,以下是一个使用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 {
background-color: #f2f2f2;
font-family: Arial, sans-serif;
color: #333;
}
h1 {
text-align: center;
margin-top: 50px;
}
form {
margin: 50px auto;
padding: 20px;
max-width: 500px;
border: 1px solid #ccc;
background-color: #fff;
}
input[type="text"], input[type="password"] {
display: block;
margin-bottom: 20px;
padding: 10px;
width: 100%;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 16px;
box-sizing: border-box;
}
input[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
float: right;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #3e8e41;
}
</style>
</head>
<body>
<h1>登录页面</h1>
<form action="#" method="post">
<label>用户名</label>
<input type="text" name="username" required>
<label>密码</label>
<input type="password" name="password" required>
<input type="submit" value="登录">
</form>
</body>
</html>
```
当用户在用户名和密码输入框中输入信息并提交表单时,可以将数据发送到指定的服务端进行验证。在这个示例中,表单的action属性值为“#”,可以被改为实际的服务端地址。