How To Create Facebook Login Page Using Html And Css

Web Development Software

Creating a Facebook login page using HTML and CSS is not only a great way to practice your coding skills, but it also allows you to understand the underlying structure and design of one of the most popular social media platforms in the world. In this article, I will guide you through the process of creating a simple Facebook login page, and add some personal touches and commentary along the way.

Getting Started

Before we dive into the code, let’s first make sure we have a clear understanding of what we’re trying to achieve. The Facebook login page consists of a form where users can enter their email address or phone number and password, and a “Log In” button that submits the form. We’ll be using HTML to structure the page and CSS to style it.

First, create a new HTML file and open it in your favorite text editor. We’ll start by adding the basic structure to our page:

<!DOCTYPE html>
<title>Facebook Login</title>
<link rel="stylesheet" type="text/css" href="style.css">
<div class="container">
<h1>Welcome to Facebook</h1>
<label for="email">Email or Phone Number:</label>
<input type="text" id="email" name="email" required>
<label for="password">Password:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Log In">

As you can see, we’ve added a container div to center the content on the page. Inside the div, we have a heading that says “Welcome to Facebook”, followed by a form with two input fields (email or phone number and password) and a submit button.

Add Some Style

Now that we have the basic structure of our page, let’s add some CSS to make it look more like the actual Facebook login page. Create a new CSS file called “style.css” and link it to your HTML file by adding the following line inside the head tag:

<link rel="stylesheet" type="text/css" href="style.css">

Now, open the “style.css” file and add the following CSS code:

.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #f0f2f5;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);

h1 {
text-align: center;
margin-bottom: 20px;

form {
display: flex;
flex-direction: column;

label {
font-weight: bold;

input[type="password"] {
margin-bottom: 10px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;

input[type="submit"] {
padding: 10px;
background-color: #1877f2;
color: #fff;
font-weight: bold;
border: none;
border-radius: 4px;
cursor: pointer;

input[type="submit"]:hover {
background-color: #1154a6;

Here, we’ve applied some basic styles to our page. We’ve set a maximum width for the container div and centered it using the margin: 0 auto; property. The container has a light gray background color, rounded corners, and a subtle box shadow to give it a polished look.

The heading is centered and has a margin-bottom to add some spacing. The form elements are displayed in a column using flexbox, and the labels are displayed in bold to make them stand out. The input fields have some padding, a light gray border, and rounded corners, while the submit button has a blue background color and changes to a darker shade on hover.


And there you have it! With just a few lines of HTML and CSS, you’ve created a simple Facebook login page. Of course, this is just the tip of the iceberg when it comes to building a fully functional login page, but it should give you a solid foundation to build upon.

Feel free to experiment with different styles, add your own personal touches, and take this project further. Login pages are an essential part of many websites and applications, so having the skills to create one from scratch is a valuable asset as a web developer.

Now that you have a basic understanding of how to create a Facebook login page using HTML and CSS, you can start exploring more advanced concepts, such as form validation, responsive design, and integrating with backend technologies to handle user authentication. Happy coding!