Registration Form with HTML and CSS #1
Join the DZone community and get the full member experience.Join For Free
What we know matters but who we are matters more.
- Brené Brown
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
Let us get started.
First, in our code editor, we are going to create a new folder. We can call the folder form. Inside that folder, we will create two files. The index.html and the style.css.
In the index.html file, we should have a bare bone structure similar to what is shown below:
Next, I am going to add the tags to the HTML page.
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:
Yes, that is ugly. Time for some CSS!
We start in the style.css file by adding color to the background of the page and also styling the form tag:
Furthermore, we need to style the labels and input. For the label, we will be adding letter-spacing, color, margin, padding and a positional direction for the label and the texts that will be within it.
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.
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.
Published at DZone with permission of deji adesoga. See the original article here.
Opinions expressed by DZone contributors are their own.