Here's a beautiful and responsive login page built with HTML and CSS. It features a modern design, smooth animations, and mobile responsiveness.
✅ Features:
- Centered card layout
- Responsive design (mobile-friendly)
- Subtle gradients and shadows
- Hover/transition effects
- Google Fonts for stylish typography
💻 Code Example
🔹 HTML + CSS (Single File)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Beautiful Login Page</title>
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;700&display=swap" rel="stylesheet">
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
body {
background: linear-gradient(135deg, #667eea, #764ba2);
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.login-box {
background: #fff;
padding: 40px;
border-radius: 12px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
width: 100%;
max-width: 400px;
text-align: center;
transition: all 0.3s ease;
}
.login-box:hover {
transform: translateY(-5px);
}
.login-box h2 {
margin-bottom: 30px;
color: #333;
}
.login-box input {
width: 100%;
padding: 12px 15px;
margin: 10px 0 20px;
border: none;
border-radius: 25px;
background: #f1f1f1;
outline: none;
transition: background 0.3s ease;
}
.login-box input:focus {
background: #e0e0e0;
}
.login-box button {
width: 100%;
padding: 12px;
border: none;
border-radius: 25px;
background: linear-gradient(to right, #667eea, #764ba2);
color: white;
font-weight: bold;
cursor: pointer;
transition: background 0.3s ease;
}
.login-box button:hover {
background: linear-gradient(to right, #764ba2, #667eea);
}
.login-box .links {
margin-top: 20px;
font-size: 0.9rem;
}
.login-box .links a {
color: #667eea;
text-decoration: none;
margin-left: 10px;
}
.login-box .links a:hover {
text-decoration: underline;
}
@media (max-width: 500px) {
.login-box {
padding: 30px 20px;
}
}
</style>
</head>
<body>
<div class="login-box">
<h2>Login</h2>
<form>
<input type="text" placeholder="Username or Email" required />
<input type="password" placeholder="Password" required />
<button type="submit">Login</button>
</form>
<div class="links">
<label><input type="checkbox" /> Remember me</label>
<a href="#">Forgot Password?</a>
</div>
</div>
</body>
</html>
📱 Responsive Behavior:
- Desktop: Form card is centered with shadow and padding.
- Mobile: Adjusts width and font sizes for small screens.
- Hover Effects: Subtle animation on form card and button for visual feedback.
🛠️ How to Use:
- Copy the code into an
.html file.
- Open in any browser.
- Customize colors, fonts, or layout as needed.
🎨 Tips for Customization:
- Change the background gradient to match your brand.
- Add icons using Font Awesome or SVGs inside the input fields.
- Add validation or backend integration for real use.
Let me know if you'd like a version with dark mode, social login buttons, or animated background!