写一个忘记密码界面html代码居中和可改背景图片
时间: 2023-11-27 13:52:43 浏览: 35
以下是一个居中并且可改背景图片的忘记密码界面的HTML代码:
```html
<!DOCTYPE html>
<html>
<head>
<title>忘记密码</title>
<style>
body {
background-image: url("background.jpg");
background-size: cover;
background-position: center;
font-family: Arial, sans-serif;
text-align: center;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
h1 {
color: #fff;
font-size: 36px;
margin-bottom: 20px;
}
form {
background-color: #fff;
padding: 40px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
max-width: 500px;
width: 100%;
}
input[type="email"], button {
padding: 10px;
font-size: 18px;
border: none;
border-radius: 5px;
margin: 10px 0;
width: 100%;
box-sizing: border-box;
}
button {
background-color: #4CAF50;
color: #fff;
cursor: pointer;
transition: background-color 0.3s ease;
}
button:hover {
background-color: #3e8e41;
}
@media (max-width: 768px) {
h1 {
font-size: 24px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>忘记密码</h1>
<form action="#" method="post">
<label for="email">邮箱:</label>
<input type="email" id="email" name="email" required>
<button type="submit">发送重置密码邮件</button>
</form>
</div>
</body>
</html>
```
将上述代码保存为一个HTML文件,随后把 `background.jpg` 文件放在同一目录下即可。你可以将 `background.jpg` 替换为你喜欢的图片,以改变背景。