用css和html写一个有着账号,密码,验证码的表单页面
时间: 2024-05-12 08:14:35 浏览: 43
好的,以下是一个简单的账号密码验证表单页面的HTML和CSS代码:
HTML代码:
```
<!DOCTYPE html>
<html>
<head>
<title>Login Form</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="container">
<form>
<h2>Login Form</h2>
<div class="input-group">
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
</div>
<div class="input-group">
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
</div>
<div class="input-group">
<label for="captcha">Captcha:</label>
<input type="text" id="captcha" name="captcha" required>
<img src="captcha.jpg" alt="Captcha Image">
</div>
<button type="submit" class="btn">Login</button>
</form>
</div>
</body>
</html>
```
CSS代码:
```
* {
box-sizing: border-box;
}
body {
background-color: #f2f2f2;
}
.container {
max-width: 500px;
margin: 40px auto;
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
h2 {
text-align: center;
font-weight: bold;
color: #333;
margin-bottom: 20px;
}
.input-group {
margin-bottom: 20px;
}
.input-group label {
display: block;
font-size: 16px;
font-weight: bold;
margin-bottom: 5px;
}
.input-group input[type="text"],
.input-group input[type="password"] {
width: 100%;
padding: 10px;
font-size: 16px;
border: none;
border-radius: 5px;
background-color: #f2f2f2;
}
.input-group input[type="text"]:focus,
.input-group input[type="password"]:focus {
outline: none;
background-color: #e5e5e5;
}
.input-group img {
vertical-align: middle;
margin-left: 10px;
cursor: pointer;
}
.btn {
display: block;
width: 100%;
padding: 10px;
font-size: 16px;
font-weight: bold;
color: #fff;
background-color: #4CAF50;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s;
}
.btn:hover {
background-color: #3e8e41;
}
```
这段代码中包含了一个账号登录表单,包含了用户名、密码和验证码,验证码是一个图片,点击可以刷新验证码。
阅读全文