Creating a login page similar to Facebook involves designing a clean and user-friendly interface. Below is an example of HTML and CSS code to create a simple login page inspired by Facebook's design. Note that this is a basic example and does not include backend functionality for authentication.
HTML Code (index.html)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login - Facebook</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<div class="left-section">
<h1>facebook</h1>
<p>Connect with friends and the world around you on Facebook.</p>
</div>
<div class="right-section">
<div class="login-box">
<form action="#" method="POST">
<input type="email" name="email" placeholder="Email or phone number" required>
<input type="password" name="password" placeholder="Password" required>
<button type="submit">Log In</button>
</form>
<a href="#" class="forgot-password">Forgotten password?</a>
<div class="divider"></div>
<button class="create-account">Create New Account</button>
</div>
</div>
</div>
</body>
</html>
CSS Code (styles.css)
/* General Reset */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
background-color: #f0f2f5;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
display: flex;
max-width: 1000px;
width: 90%;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
overflow: hidden;
}
.left-section {
flex: 1;
background-color: #1877f2;
color: #fff;
padding: 40px;
}
.left-section h1 {
font-size: 48px;
font-weight: bold;
margin-bottom: 20px;
}
.left-section p {
font-size: 20px;
}
.right-section {
flex: 1;
padding: 40px;
display: flex;
justify-content: center;
align-items: center;
}
.login-box {
width: 100%;
max-width: 400px;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
.login-box form {
display: flex;
flex-direction: column;
}
.login-box input {
height: 50px;
margin-bottom: 15px;
padding: 0 15px;
font-size: 16px;
border: 1px solid #dddfe2;
border-radius: 6px;
}
.login-box button {
height: 50px;
background-color: #1877f2;
color: #fff;
font-size: 18px;
font-weight: bold;
border: none;
border-radius: 6px;
cursor: pointer;
}
.login-box button:hover {
background-color: #165cdb;
}
.forgot-password {
display: block;
text-align: center;
margin: 15px 0;
color: #1877f2;
text-decoration: none;
font-size: 14px;
}
.forgot-password:hover {
text-decoration: underline;
}
.divider {
height: 1px;
background-color: #dddfe2;
margin: 20px 0;
}
.create-account {
height: 50px;
background-color: #42b72a;
color: #fff;
font-size: 18px;
font-weight: bold;
border: none;
border-radius: 6px;
cursor: pointer;
}
.create-account:hover {
background-color: #36a420;
}
How It Works
-
HTML Structure: The page is divided into two sections:
- The left section contains the Facebook logo and a tagline.
- The right section contains the login form and a button to create a new account.
-
CSS Styling:
- The left section has a blue background with white text, mimicking Facebook's branding.
- The right section has a clean, white background with a login form styled to look modern and user-friendly.
-
Responsive Design: The layout is responsive and adjusts to different screen sizes using flexbox.
Notes
- This is a front-end-only implementation. To make it functional, you need to integrate it with a backend system (e.g., PHP, Node.js, or Python) and a database for user authentication.
- Replace the
# in the form action attribute with the URL of your backend login endpoint.
- Ensure you use HTTPS and secure practices when handling user credentials.
Let me know if you need help with the backend or additional features!