THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

Create a Responsive Login Form in HTML and CSS in Hindi

Create a Responsive Login Form in HTML and CSS in Hindi


Login Form in HTML and CSS


In this video, we will we see How to Create a Responsive Login Form in HTML and CSS in Hindi step by step.

As you can see I try to make a Login form that should be different from others available online on any social media. Believe me, you gonna learn many new technique and tips on how to make a Responsive Login Form in HTML and CSS in Hindi.

Let's talk about the background of the Login form in Hindi first. You can see It's a diagonal background and I know must of are thinking how we can create a diagonal webpage. Believe me, I wrote only one line of code to get the diagonal background on my Login Form in Hindi.

background-image: linear-gradient(to top right, #color1 50%, #color2 50%);

Create a Responsive Login Form in HTML and CSS in Hindi


Now we will come to our Center Div. If you noticed I used the same code to give the background color as we did on the main background. I only interchanged the color name and we have an awesome background center div. Also, on how to make a div perfectly center both horizontally and vertically is by using the position and translate property of CSS.

I know most of the programmer at first face problem on how to make the image half center on top and then perfectly center of the total width. Again here we will use the position concept of CSS and also we will use calc() property of CSS and it is the best in making anything responsive.

So what is calc()?
It takes the expression or maths calculation to solve and try to make perfect?

Create a Responsive Login Form in HTML and CSS in Hindi

Finally, we have beautiful centered Input fields and Buttons. Here also I show you how to make the input field centered and responsive.

Point to remember is that Input field is by default Inline, So we need to specify display: block.

I know must of you are here for source code only. Here is the source code.

Index.html file





<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>LoginForm</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link href="https://fonts.googleapis.com/css?family=Cinzel" rel="stylesheet">
</head>
<body>
<div class="bgimg">
<div class="centerdiv">
<img src="https://cdn1.iconfinder.com/data/icons/flat-business-icons/128/user-128.png" id="profilepic">
<h2>user login</h2>
<form>
<div>
<input type="text" name="" class="inputbox" placeholder="Username">
</div>
<br>
<div>
<input type="Password" name="" class="inputbox" placeholder="Password">
</div>
<br>
<div>
<button type="submit"> LOGIN </button>
</div>
</form> <br>
<div class="FORGOT-SECTION">
<h4>Forget Password?</h4>
</div>
</div>
</div>

</body>
</html>


style.css File Code


*{
margin: 0;
padding: 0;
font-family: 'Cinzel', serif;
}

.bgimg{
width: 100%;
height: 100vh;
background-image: linear-gradient(27deg, #004E95 50%, #013A6B 50%);
}

.centerdiv{
width: 350px;
height: 400px;
position: absolute;
top: 50%;
left: 50%;
background-color: red;
transform: translate(-50%, -50%);
background-image: linear-gradient(27deg, #013A6B 50%, #004E95 50%);
box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.24);
}

#profilepic{
width: 120px;
height: 120px;
border-radius: 50%;
position: relative;
top: -60px;
left: calc( (350px - 120px) / 2 )
}

h2{
text-align: center;
color: white;
text-transform: uppercase;
font-size: 2em;
word-spacing: 10px;
margin-top: -50px;
margin-bottom: 50px;
text-shadow: -2px 2px 1px #0A84C6;
}

.inputbox{
width: calc(100% - 40px);
height: 30px;
display: block;
margin: auto;
padding: 0 10px;
box-sizing: border-box;
}

::placeholder{
letter-spacing: 2px;
color: black;
}

button{
width: calc(100% - 40px);
height: 30px;
display: block;
margin: auto;
color: white;
background-color: #0A84C6;
border: none;
}

.FORGOT-SECTION{
width: calc(100% - 40px);
line-height: 30px;
display: block;
margin: auto;
color: white;
background-color: dodgerblue;
text-transform: uppercase;
font-size: 0.8em;
text-align: right;
padding-right: 20px;
box-sizing: border-box;

}