Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
How to Create Netflix Login Page in HTML and CSS?
Creating a Netflix login page replica is an excellent way to practice web development skills and understand modern UI design principles. This tutorial will guide you through building a complete Netflix login page using HTML and CSS.
Why Create a Netflix Login Page?
Building a Netflix login page helps developers in several ways
- Learn Layout Techniques: Practice creating responsive layouts and form design
- Portfolio Project: Showcase your CSS skills to potential employers
- UI/UX Understanding: Study how popular platforms design user interfaces
Basic Layout Structure
The Netflix login page contains these essential elements
- Netflix Logo: Positioned in the top-left corner
- Background Image: A movie collage background with dark overlay
- Login Form: Central form with email, password, and sign-in functionality
- Footer: Links for help, FAQs, and terms of service
HTML Structure
First, let's create the basic HTML structure for our Netflix login page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Netflix</title>
</head>
<body>
<div class="banner">
<div class="logo">
<img src="https://i.ibb.co/SNKRx9w/Netflixlogo.png" alt="Netflix">
</div>
<div class="main">
<div class="form1">
<form>
<h1>Sign In</h1>
<div class="input-field">
<input type="email" required placeholder=" ">
<span>Email or mobile number</span>
<p class="error-message">Please enter a valid email address</p>
</div>
<div class="input-field">
<input type="password" required placeholder=" ">
<span>Password</span>
</div>
<button class="button1" type="submit">Sign In</button>
<div class="or"><p>OR</p></div>
<button class="button2" type="button">Use a sign-in code</button>
<div class="fp"><a href="#">Forgot Password?</a></div>
<div class="checkbox">
<label class="container">Remember me
<input type="checkbox">
<span class="checkmark"></span>
</label>
</div>
<div class="signup">
<p>New to Netflix?</p>
<a href="#">Sign up now</a>
</div>
</form>
</div>
</div>
<footer>
<div class="contact">
Questions? Call <a href="tel:000-800-919-1694">000-800-919-1694</a>
</div>
<div class="ftr">
<a href="#">FAQ</a>
<a href="#">Help Centre</a>
<a href="#">Terms of Use</a>
<a href="#">Privacy</a>
</div>
</footer>
</div>
</body>
</html>
CSS Styling
Now let's add the CSS to style our Netflix login page. The key styling techniques include
-
Background Overlay: Using
::afterpseudo-element for dark overlay - Floating Labels: Creating animated labels that move when input is focused
- Form Validation: Visual feedback for invalid inputs
- Responsive Design: Flexible layout that works on different screen sizes
Complete Netflix Login Page
Here's the complete code with HTML and CSS combined
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Netflix</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: #000;
color: #999;
}
.banner {
width: 100%;
height: 100vh;
position: relative;
background: url('https://assets.nflxext.com/ffe/siteui/vlv3/9d3533b2-0e2b-40b2-95e0-ecd7979cc88b/a3873901-5b7c-46eb-b9fa-12fea5197bd6/IN-en-20240311-popsignuptwoweeks-perspective_alpha_website_large.jpg') no-repeat center center/cover;
}
.banner::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.6);
z-index: 1;
}
.logo {
position: relative;
z-index: 2;
padding: 20px 50px;
}
.logo img {
width: 150px;
height: auto;
}
.main {
position: relative;
z-index: 2;
width: 450px;
background: rgba(0, 0, 0, 0.75);
margin: 0 auto;
padding: 60px 68px 40px;
border-radius: 4px;
}
.form1 h1 {
color: #fff;
font-size: 32px;
margin-bottom: 28px;
font-weight: 700;
}
.input-field {
position: relative;
margin-bottom: 16px;
}
.input-field input {
width: 100%;
height: 50px;
background: #333;
border: none;
border-radius: 4px;
padding: 16px 20px 0;
font-size: 16px;
color: #fff;
}
.input-field input:focus {
outline: none;
background: #454545;
}
.input-field span {
position: absolute;
left: 20px;
top: 50%;
transform: translateY(-50%);
color: #8c8c8c;
font-size: 16px;
transition: all 0.3s ease;
pointer-events: none;
}
.input-field input:focus + span,
.input-field input:not(:placeholder-shown) + span {
top: 16px;
font-size: 11px;
color: #8c8c8c;
}
.error-message {
display: none;
color: #e87c03;
font-size: 13px;
margin-top: 6px;
}
.input-field input:invalid:not(:placeholder-shown):not(:focus) + span + .error-message {
display: block;
}
.button1, .button2 {
width: 100%;
height: 48px;
background: #e50914;
border: none;
border-radius: 4px;
color: #fff;
font-size: 16px;
font-weight: 700;
cursor: pointer;
margin-bottom: 12px;
transition: background 0.3s ease;
}
.button1:hover {
background: #f40612;
}
.button2 {
background: rgba(109, 109, 110, 0.7);
font-weight: 400;
}
.button2:hover {
background: rgba(109, 109, 110, 0.4);
}
.or {
text-align: center;
margin: 16px 0;
}
.fp {
text-align: center;
margin: 16px 0;
}
.fp a {
color: #fff;
text-decoration: none;
font-size: 13px;
}
.fp a:hover {
text-decoration: underline;
}
.checkbox {
margin: 12px 0;
}
.container {
position: relative;
padding-left: 25px;
cursor: pointer;
color: #b3b3b3;
font-size: 13px;
}
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
}
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 16px;
width: 16px;
background-color: #737373;
border-radius: 2px;
}
.container:hover input ~ .checkmark {
background-color: #b3b3b3;
}
.container input:checked ~ .checkmark {
background-color: #fff;
}
.checkmark:after {
content: "";
position: absolute;
display: none;
}
.container input:checked ~ .checkmark:after {
display: block;
}
.container .checkmark:after {
left: 5px;
top: 2px;
width: 3px;
height: 6px;
border: solid black;
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
.signup {
margin-top: 16px;
color: #737373;
font-size: 16px;
}
.signup a {
color: #fff;
text-decoration: none;
margin-left: 4px;
}
.signup a:hover {
text-decoration: underline;
}
footer {
position: relative;
z-index: 2;
background: rgba(0, 0, 0, 0.75);
padding: 30px 0;
margin-top: 70px;
}
.contact {
color: #737373;
font-size: 16px;
margin-bottom: 30px;
text-align: center;
}
.contact a {
color: #737373;
text-decoration: none;
}
.contact a:hover {
text-decoration: underline;
}
.ftr {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 20px;
}
.ftr a {
color: #737373;
text-decoration: underline;
font-size: 13px;
}
.ftr a:hover {
color: #fff;
}
@media (max-width: 500px) {
.main {
width: 100%;
margin: 0 20px;
padding: 48px 68px 36px;
}
.logo {
padding: 20px 20px;
}
}
</style>
</head>
<body>
<div class="banner">
<div class="logo">
<img src="https://i.ibb.co/SNKRx9w/Netflixlogo.png" alt="Netflix">
</div>
<div class="main">
<div class="form1">
<form>
<h1>Sign In</h1>
<div class="input-field">
<input type="email" required placeholder=" ">
<span>Email or mobile number</span>
<p class="error-message">Please enter a valid email address.</p>
</div>
<div class="input-field">
<input type="password" required placeholder=" ">
<span>Password</span>
</div>
<button class="button1" type="submit">Sign In</button>
<div class="or"><p>OR</p></div>
<button class="button2" type="button">Use a sign-in code</button>
<div class="fp"><a href="#">Forgot password?</ Advertisements
