网站登录界面代码加背景
时间: 2023-10-28 13:04:49 浏览: 39
以下是一个简单的网站登录界面代码,包括背景图案:
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style>
body {
background-image: url('background.jpg');
background-size: cover;
background-repeat: no-repeat;
background-position: center;
font-family: Arial, sans-serif;
}
h1 {
text-align: center;
font-size: 2.5em;
margin-top: 50px;
color: #fff;
text-shadow: 2px 2px #000;
}
form {
background-color: #fff;
padding: 20px;
border-radius: 5px;
margin: 0 auto;
max-width: 400px;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
}
label {
display: block;
margin-bottom: 10px;
font-size: 1.2em;
color: #333;
}
input {
display: block;
width: 100%;
padding: 10px;
margin-bottom: 20px;
font-size: 1.2em;
border-radius: 5px;
border: none;
box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.1);
}
input[type="submit"] {
background-color: #333;
color: #fff;
font-size: 1.2em;
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #555;
}
</style>
</head>
<body>
<h1>Login Page</h1>
<form>
<label for="username">Username:</label>
<input type="text" id="username" name="username" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Login">
</form>
</body>
</html>
```
在上面的代码中,我们在 `body` 元素中设置了一个背景图片,用于作为登录页面的背景。我们还为 `h1` 元素添加了一些样式,使其在背景图案上更加醒目。
登录表单在一个白色背景的 `form` 元素中,并带有一些样式,如圆角、阴影和输入框边框。登录按钮也带有样式,鼠标移动到上面时会有一个过渡动画。
这只是一个简单的示例,您可以根据自己的需求进行更改和定制。