Introduction: 

Below is a responsive login page created using HTML and CSS, designed with an attractive and modern layout. The design features a centered login form with a clean, professional look, including a gradient background, subtle animations, and responsiveness for various screen sizes (desktops, tablets, and mobiles). The form includes fields for username and password, a submit button, and a “Forgot Password?” link, styled with hover effects and a mobile-friendly layoutlogin


Code:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive Login Page</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Arial', sans-serif;
}

body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: linear-gradient(135deg, #6e8efb, #a777e3);
}

.login-container {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
width: 100%;
max-width: 400px;
text-align: center;
}

.login-container h2 {
margin-bottom: 20px;
color: #333;
font-size: 24px;
}

.input-group {
margin-bottom: 20px;
text-align: left;
position: relative;
}

.input-group label {
display: block;
margin-bottom: 5px;
color: #555;
font-size: 14px;
}

.input-group input {
width: 100%;
padding: 10px 10px 10px 35px;
border: 1px solid #ddd;
border-radius: 5px;
font-size: 16px;
transition: border-color 0.3s;
}

.input-group input:focus {
outline: none;
border-color: #6e8efb;
}

.input-group i {
position: absolute;
left: 10px;
top: 38px;
color: #6e8efb;
font-size: 16px;
}

.login-btn {
width: 100%;
padding: 12px;
background: #6e8efb;
border: none;
border-radius: 5px;
color: white;
font-size: 16px;
cursor: pointer;
transition: background 0.3s;
}

.login-btn:hover {
background: #5a78e0;
}

.links {
margin-top: 15px;
}

.links a {
color: #6e8efb;
text-decoration: none;
font-size: 14px;
display: block;
margin-bottom: 10px;
}

.links a:hover {
text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 600px) {
.login-container {
padding: 20px;
margin: 20px;
}

.login-container h2 {
font-size: 20px;
}

.input-group input {
font-size: 14px;
padding: 8px 8px 8px 30px;
}

.input-group i {
top: 36px;
font-size: 14px;
left: 8px;
}

.login-btn {
font-size: 14px;
padding: 10px;
}

.links a {
font-size: 12px;
}
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form>
<div class="input-group">
<label for="username">Username</label>
<i class="fas fa-user"></i>
<input type="text" id="username" placeholder="Enter your username" required>
</div>
<div class="input-group">
<label for="password">Password</label>
<i class="fas fa-lock"></i>
<input type="password" id="password" placeholder="Enter your password" required>
</div>
<button type="submit" class="login-btn">Login</button>
<div class="links">
<a href="#">Forgot Password?</a>
<a href="#">Create an Account</a>
</div>
</form>
</div>
</body>
</html>

Features of the Login Page

  • Attractive Layout: The login form is centered on a gradient background (blue to purple), with a white card-like container featuring rounded corners and a subtle shadow for a modern look.
  • Responsive Design: The layout adjusts seamlessly for different screen sizes using media queries. On screens smaller than 600px (e.g., mobiles), padding, font sizes, and margins are reduced for better usability.
  • Interactive Elements: Input fields have a focus effect (border color changes), and the login button darkens on hover. The “Forgot Password?” link underlines on hover for clarity.
  • Clean Styling: Uses Arial font, consistent spacing, and a minimalistic design to ensure readability and aesthetic appeal.
  • Form Structure: Includes username and password fields with placeholders, labels, and a submit button, all marked as required for basic form validation.

How to Use

  • Save the code as index.html and open it in a web browser to view the login page.
  • The form is static (no backend functionality). To add functionality, you can integrate JavaScript for client-side validation or a backend (e.g., Node.js, PHP) for authentication.
  • Customize colors, fonts, or gradients in the CSS to match your preferred theme.
error: Content is protected !!
Scroll to Top