Do you want to be a good Web Developer?

Enter Your Email To Get Our Exclusive Tutorials
And Offer Right In Your Email

Join TalkersCode Community And Recieve Exclusive Tutorials
On Web Development Right Via Email.

Responsive Login And Signup Form Using HTML And CSS

Thursday, Aug 25, 2016

Tags:- HTML CSS


In this tutorial we will show you how to create responsive login and signup form using HTML and CSS media query.We add both login and signup form in single page so that it will be easy to do login and signup for user.


See Demo
Responsive Login And Signup Form Using HTML And CSS


To Create Responsive Login And Signup Form It Takes Only Two Steps:-

  1. Make a HTML file and define
  2. Make a CSS file and define styling


Step 1.Make a HTML file and define

We make a HTML file and save it with a name responsive_form.html

<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0"/>
<link href="responsive_style.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<div id="wrapper">

<div class="form_div">
<p class="form_label">LOGIN FORM</p>
<form method="post" action="">
<p><input type="text" placeholder="Enter Email"></p>
<p><input type="password" placeholder="**********"></p>
<p><input type="submit" value="LOGIN"></p>
</form>
</div>
<br>
<br>
<br>
<div class="form_div">
<p class="form_label">SIGNUP FORM</p>
<form method="post" action="">
<p><input type="text" placeholder="Enter Name"></p>
<p><input type="text" placeholder="Enter Email"></p>
<p><input type="password" placeholder="**********"></p>
<p><input type="submit" value="SIGNUP"></p>
</form>
</div>

</div>
</body>
</html>

In this step we create two form one form login and another for signup these are just a dummy form you will not get signup or login.We add our css file 'responsive_style.css' which we were going to create in next step.We also add viewport meta tag it is used to tell browser that render this page is as a responsive webpage.



Step 2.Make a CSS file and define styling

We make a CSS file and save it with a name responsive_style.css

body
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:100%;
 font-family: "Myriad Pro","Helvetica Neue",Helvetica,Arial,Sans-Serif;
 background-color:#ECF0F1;
}
#wrapper
{
 margin:0 auto;
 padding:0px;
 text-align:center;
 width:995px;
}
#wrapper h1
{
 margin-top:50px;
 font-size:45px;
 color:#424949;
}
#wrapper h1 p
{
font-size:18px;
}
.form_div
{
width:330px;
margin-left:320px;
padding:10px;
background-color:#424949;
}
.form_div .form_label
{
margin:15px;
margin-bottom:30px;
font-size:25px;
font-weight:bold;
color:white;
text-decoration:underline;
}
.form_div input[type="text"],input[type="password"]
{
width:230px;
height:40px;
border-radius:2px;
font-size:17px;
padding-left:5px;
border:none;
}
.form_div input[type="submit"]
{
width:230px;
height:40px;
border:none;
border-radius:2px;
font-size:17px;
background-color:#7F8C8D;
border-bottom:3px solid #616A6B;
color:white;
font-weight:bold;
}

@media only screen and (min-width:700px) and (max-width:995px)
{
#wrapper
{
width:100%;
}
#wrapper h1
{
font-size:30px;
}
.form_div
{
width:50%;
margin-left:25%;
padding-left:0px;
padding-right:0px;
}
.form_div input[type="text"],input[type="password"]
{
width:80%;
}
.form_div textarea
{
width:80%;
}
.form_div input[type="submit"]
{
width:80%;
}
}
@media only screen and (min-width:400px) and (max-width:699px)
{
#wrapper
{
width:100%;
}
#wrapper h1
{
font-size:30px;
}
.form_div
{
width:60%;
margin-left:20%;
}
.form_div input[type="text"],input[type="password"]
{
width:80%;
}
.form_div input[type="submit"]
{
width:80%;
}
}
@media only screen and (min-width:100px) and (max-width:399px)
{
#wrapper
{
width:100%;
}
#wrapper h1
{
font-size:25px;
}
.form_div
{
width:90%;
margin-left:5%;
padding-left:0px;
padding-right:0px;
}
.form_div input[type="text"],input[type="password"]
{
width:80%;
}
.form_div input[type="submit"]
{
width:80%;
}
}

In this step we add simple media queries to make our form responsive.


That's all, this is how to create responsive login and signup form using HTML and CSS.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

Join Us With Our 21000+ Subscribers And Get Our Latest Tutorials Update Via Email