{{announcement.body}}
{{announcement.title}}

Registration Form with HTML and CSS #1

DZone 's Guide to

Registration Form with HTML and CSS #1

Today we are going to build a simple registration form. The requirements for this tutorial is just HTML, CSS and a code editor.As we all know,

· Web Dev Zone ·
Free Resource

What we know matters but who we are matters more.

-  Brené Brown

Introduction

Today we are going to build a simple registration form. The requirements for this tutorial is just a basic knowledge of Html and  CSS as well as a code editor.

A Preview of What We Are Going To Build

complete form design

Let us get started.

Code Structure

First, in our code editor, we are going to create a new folder. We can call the folder formInside that folder, we will create two files. The index.html and the style.css.

HTML

In the index.html file, we should have a bare bone structure similar to what is shown below:

HTML


Next, I am going to add the tags to the HTML page.

HTML
 


From the code above, we started by adding a form tag. In the form tag, there are four label tags and a button tag. Each input tag is wrapped in a label.

These labels are very important because they tell the user what information to provide in the form element.

This is all we need for the Html code and our form should look something like this:

HTML preview

HTML preview


Yes, that is ugly. Time for some CSS!

CSS

We start in the style.css file by adding color to the background of the page and also styling the form tag:

CSS
 




xxxxxxxxxx
1
10


 
1
body {  
2
  background: #C5E1A5; 
3
}
4
 
          
5
 form {  
6
   width: 30%;  
7
   margin: 60px auto;  
8
   background: #efefef;  
9
   padding: 60px 120px 80px 120px;  
10
   text-align: center;  
11
   -webkit-box-shadow: 2px 2px 3px rgba(0,0,0,0.1); 
12
   box-shadow: 2px 2px 3px rgba(0,0,0,0.1); 
13
}



The Outcome:

first CSS preview

Furthermore, we need to style the labels and input. For the labelwe will be adding letter-spacing, color, margin, padding and a positional direction for the label and the texts that will be within it.

CSS
 

The Outcome:

second css preview

Finally, we will be styling the line for the input field and the button.

To get the line effect, we need to set the height in the .line-box class. This will make the line visible. Also, we will be adding some transition effect when the input field is active.

The design for the button class is straight forward, We added a hover color, a background color, padding and border-radius. We also set the display to inline-block, this allows us to set padding to the side of the button.

CSS
 


Final Results:

final view

Conclusion

I know this is a very basic tutorial, but I hope you can learn one or two things from it.

Here is the link to the repo on Github.

Support me by subscribing to my newsletter here.

Topics:
css, html, web development

Published at DZone with permission of deji adesoga . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}