写一个有背景的前端登录页面
时间: 2024-05-22 21:12:03 浏览: 10
背景:假设这是一个电商平台,我们可以在登录页面上添加一些商品图片或者配色方案,以便让用户感受到这是一个具有商业氛围的网站。
登录页面布局:我们可以把登录页面分成两个部分,左边是登录信息的输入框,右边是商品图片展示区。
代码实现:以下是一个简单的前端登录页面实现代码,仅供参考。
```html
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f7f7f7;
}
.container {
display: flex;
align-items: center;
justify-content: space-between;
height: 100vh;
padding: 0 10%;
}
.login-form {
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
border-radius: 5px;
padding: 50px 30px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
min-width: 400px;
}
.login-form h2 {
margin-bottom: 30px;
font-weight: normal;
color: #333;
}
.login-form input[type="text"], .login-form input[type="password"] {
width: 100%;
height: 40px;
border: none;
border-radius: 5px;
margin-bottom: 20px;
padding: 0 10px;
font-size: 16px;
color: #555;
background-color: #f7f7f7;
}
.login-form button[type="submit"] {
background-color: #333;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
font-size: 16px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.login-form button[type="submit"]:hover {
background-color: #555;
}
.product-images {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
width: 60%;
}
.product-images img {
width: 30%;
margin-bottom: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
border-radius: 5px;
}
</style>
</head>
<body>
<div class="container">
<div class="login-form">
<h2>Login</h2>
<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>
<button type="submit">Login</button>
</form>
</div>
<div class="product-images">
<img src="https://via.placeholder.com/150x150.png?text=Product+1" alt="Product 1">
<img src="https://via.placeholder.com/150x150.png?text=Product+2" alt="Product 2">
<img src="https://via.placeholder.com/150x150.png?text=Product+3" alt="Product 3">
<img src="https://via.placeholder.com/150x150.png?text=Product+4" alt="Product 4">
<img src="https://via.placeholder.com/150x150.png?text=Product+5" alt="Product 5">
<img src="https://via.placeholder.com/150x150.png?text=Product+6" alt="Product 6">
</div>
</div>
</body>
</html>
```