Forgot Password Form using CSS
Hello Guys! In this blog, I'm going to explain to you how to make a Forgot Password Form with glassmorhism effect using CSS. This will be a step-by-step guide including HTML and CSS. Let's get started 🚀.
Let's cover the HTML part
Now let's import the fonts using Google Fonts API. Below is the code for Poppins Font. Paste the below code in head tag.
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
Now let's design the card in our <body> tag. In the below HTML code, we have created a card <div> that contains the forgot password form input fields with <p> tag to hold the lock icon, <h2> tag for heading, again <p> tag for info, <input> tag for email input, and button.
<div class="card">
<p class="lock-icon"><i class="fas fa-lock"></i></p>
<h2>Forgot Password?</h2>
<p>You can reset your Password here</p>
<input type="text" class="passInput" placeholder="Email address">
<button>Send My Password</button>
</div>
Here is the Final HTML Code
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Font Awesome Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"
integrity="sha512-+4zCK9k+qNFUR5X+cKL9EIR+ZOhtIloNl9GIKS57V1MyNsYpYcUrUeQc9vNfzsWfV28IaLL3i96P9sdNyeRssA=="
crossorigin="anonymous" />
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins&display=swap" rel="stylesheet">
<title>Forgot Password UI Using CSS - @code.scientist x @codingtorque</title>
</head>
<body>
<div class="card">
<p class="lock-icon"><i> class="fas fa-lock"></i></p>
<h2>Forgot Password?</h2>
<p>You can reset your Password here</p>
<input type="text" class="passInput" placeholder="Email address">
<button>Send My Password</button>
</div>
</body>
</html>
Output Till Now
Let's understand CSS Part
In the below CSS code,
- We declare a * selectors to set the font Poppins that we have imported in our head tag.
- Next we declare a body selector which consists of styles for dark mode and aligns all elements in the body to the center.
- Next, we have a card that contains backdrop-filter: blur(10px), background: semi-transparent, and border property to create an amazing glassmorphism effect.
- Next, we have h2, p, .passInput, button with basic stylings.
* {
margin: 0;
padding: 0;
font-family: 'Poppins', sans-serif;
}
body {
background-color: #ff99f5;
background-image:
radial-gradient(at 61% 4%, hsla(303, 91%, 61%, 1) 0px, transparent 50%),
radial-gradient(at 75% 66%, hsla(196, 91%, 79%, 1) 0px, transparent 50%),
radial-gradient(at 98% 88%, hsla(76, 87%, 78%, 1) 0px, transparent 50%),
radial-gradient(at 23% 16%, hsla(238, 96%, 77%, 1) 0px, transparent 50%),
radial-gradient(at 95% 65%, hsla(13, 91%, 75%, 1) 0px, transparent 50%),
radial-gradient(at 10% 79%, hsla(228, 96%, 69%, 1) 0px, transparent 50%),
radial-gradient(at 85% 58%, hsla(328, 81%, 68%, 1) 0px, transparent 50%);
background-repeat: no-repeat;
color: white;
display: flex;
align-items: center;
justify-content: center;
padding: 15rem 0;
}
.card {
backdrop-filter: blur(16px) saturate(180%);
-webkit-backdrop-filter: blur(16px) saturate(180%);
background-color: rgba(0, 0, 0, 0.75);
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.125);
display: flex;
flex-direction: column;
align-items: center;
padding: 30px 40px;
}
.lock-icon {
font-size: 3rem;
}
h2 {
font-size: 1.5rem;
margin-top: 10px;
text-transform: uppercase;
}
p {
font-size: 12px;
}
.passInput {
margin-top: 15px;
width: 80%;
background: transparent;
border: none;
border-bottom: 2px solid deepskyblue;
font-size: 15px;
color: white;
outline: none;
}
button {
margin-top: 15px;
width: 80%;
background-color: deepskyblue;
color: white;
padding: 10px;
text-transform: uppercase;
}
Output Till Now
If you want me to code any project or post any specific post,
feel free to DM me at IG @code.scientist or @codingtorque
If you have any doubt or any project ideas feel free to
Contact Us
Hope you find this post helpful💖
Written by: Coding Torque | Piyush Patil
Follow us on Instagram for more projects like
this👨💻