<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>登录页面</title> <style> body { background-color: #f2f2f2; } .container { width: 400px; margin: 0 auto; margin-top: 100px; padding: 20px; background-color: #fff; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } h2 { text-align: center; margin-bottom: 20px; } label { display: block; margin-bottom: 10px; } input[type="text"], input[type="password"] { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 5px; } input[type="submit"] { width: 100%; padding: 10px; background-color: #4CAF50; color: #fff; border: none; border-radius: 5px; cursor: pointer; } input[type="submit"]:hover { background-color: #45a049; } </style> </head> <body> <div class="container"> <h2>登录</h2> <form action="login.php" method="POST"> <label for="username">用户名:</label> <input type="text" id="username" name="username" required> <label for="password">密码:</label> <input type="password" id="password" name="password" required> <input type="submit" value="登录"> </form> </div> </body> </html> 修改上述代码使背景颜色变为蓝色,点击登录后可以跳转到lianxiren.php
时间: 2024-02-14 13:27:30 浏览: 401
你可以通过修改代码中的CSS样式来实现背景颜色的变化和跳转功能。请尝试将以下代码替换到原有的代码中:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>登录页面</title>
<style>
body {
background-color: blue; /* 将背景颜色改为蓝色 */
}
.container {
width: 400px;
margin: 0 auto;
margin-top: 100px;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}
h2 {
text-align: center;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 10px;
}
input[type="text"], input[type="password"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
input[type="submit"] {
width: 100%;
padding: 10px;
background-color: #4CAF50;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #45a049;
}
</style>
</head>
<body>
<div class="container">
<h2>登录</h2>
<form action="lianxiren.php" method="POST"> <!-- 将 action 属性的值改为 lianxiren.php -->
<label for="username">用户名:</label>
<input type="text" id="username" name="username" required>
<label for="password">密码:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="登录">
</form>
</div>
</body>
</html>
```
这样修改后的代码将会使背景颜色变为蓝色,并且点击登录按钮后会跳转到 `lianxiren.php` 页面。
阅读全文