In my third project I cloned the Facebook login page using HTML and CSS. I learnt many new things in this project. Here is what I learnt.

1. font-family

I used font-family inside the * selector, so the same font works on the whole page.

* { padding: 0; margin: 0; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; } 

If the first font is not available it uses the next one. So I wrote more than one font name.

2. Page height with vh

I divided the page into two parts using vh.

main { height: 90vh; } footer { height: 10vh; } 

The main part takes 90% of the screen height and the footer takes 10%.

3. Grid

I used Grid to split the page into a big left side and a small right side.

main { display: grid; grid-template-columns: 2fr 1fr; } 

2fr 1fr means the left side is double the size of the right side.

4. Grid inside a Grid

The left side is also a grid. I used it again to make two more columns inside.

.left { display: grid; grid-template-columns: 1fr 2fr; } 

So I learnt that I can put a grid inside another grid.

5. Border on only one side

Before this I used border for all four sides. Now I made a border to only one side to replicate the original web page.

footer { border-top: 1px solid lightgrey; } .right { border-left: 1px solid lightgrey; } 

border-top gives a line only on the top.
border-left gives a line only on the left.

6. Centering with Flexbox

I wanted the login box to be exactly in the middle of the right side. I used Flexbox for this.

.right { display: flex; justify-content: center; align-items: center; padding: 50px; } 

justify-content: center puts the item in center in row side.
align-items: center puts the item in the center in column side.

7. gap and width

I used Flexbox with flex-direction: column for the login form and I learnt a new property called gap.

.login { display: flex; flex-direction: column; gap: 12px; width: 100%; } 

gap gives equal space between the items. I did not need to use margin on every item.But gap can be used only when we display in grid or flex
width: 100% makes the form take the full width of its parent box

8. Selecting specific tags inside a class

.login input { padding: 16px; border-radius: 10px; border: 1px solid; font-size: 16px; } 

.login input means only the input boxes inside the login class. other inputs on the page will not change.

9. Input boxes

I used two input boxes in the form.

<input type="text" placeholder="Email address or mobile number"> <input type="password" placeholder="Password"> 
  • type="text" is for normal text.
  • type="password" hides the letters with dots.
  • placeholder shows text inside the box which disappears when we start typing.

10. buttons

I styled three different buttons Log in, Forgotten Password and Create new account.

.login-btn { background-color: #0064e0; border: none; color: white; padding: 14px; border-radius: 25px; font-size: 16px; cursor: pointer; } 

background-color changes the colour of the button.
border: none removes the default border.
border-radius: 25px makes the corners round like a pill.
cursor: pointer shows the hand icon when we move the mouse on the button.

11. Hover

I learnt :hover. It changes the style when the mouse is on the element.

.forgot-btn:hover { background-color: gainsboro; } 

When I move the mouse on the button the colour changes to light grey.

12. images

I used two images one is the Facebook logo and the other is the big picture on the left.

.img-tag img { width: 100%; height: 100%; } .logo img { width: 55px; margin: 30px; } 

width: 100% and height: 100% make the image fill its box.
For the logo I gave a small width of 55px and some margin around it

13. line height

I used these to place the heading "Explore the things you love." in the right place.

.logo h1 { font-size: 64px; line-height: 50px; width: 200px; margin-top: 400px; margin-left: 50px; } 

line-height is the space between two lines of text.
width: 200px makes the text break into many lines.
margin-top and margin-left push the heading down and to the right.

14. Menu in Footer

For the footer languages I used an ul list but made it look like a menu which i felt easier.

ul { display: flex; justify-content: center; gap: 20px; list-style-type: none; padding: 50px; color: grey; } a { text-decoration: none; color: grey; } 

display: flex puts the list items side by side.
list-style-type: none removes the bullet points.
text-decoration: none removes the underline from links.
color: grey changes the colour of the text and the links.

15. Some new tags

<main> is for the main part of the page.
<footer> is for the bottom part of the page.
<button> makes a button.
<a href=""> makes a link.

That's how I cloned the Facebook login page. In this project I learnt centering with flexbox, gap, hover, styling buttons and inputs, and making a menu from a list. I'm looking forward to learning more in my next projects.