Creating a Form Page using HTML

Naghma Alam
3 min readOct 22, 2020

--

what is HTML form?

An HTML form is used to collect the user input which in turn sends to the server for processing.

How to create the Html form?

It is created by using the <form> element for the user input.

<form>

form elements…..

</form>

The form elements consist of different types of input elements such as: text fields, radio buttons, submit buttons, passwords, checkboxes, etc.

HTML <form> elements:

<input> element

fig-1 Code
fig-1.1 Output

The <input> element can be displayed in many ways depending upon the type attribute. In the above fig-1 input have type attribute which is assigned to text in first input element and in another input element it is assigned to type submit.

<label> element

<label> element defines the label for the form elements. is useful for screen-reader users. In the above fig-1 the label element provide the lebel ‘First name’ for the input type text as seen in fig 1.1.

<select> and <option> element

The <select> element defines the drop down list and <option> element defines an option that can be selected. By default the first element in the option list is selected.

fig-2 code
fig-2.1 output

<textarea> element

This element defines a multi-line input field which is a text area. here we use two attributes called rows and columns to define the width and height of the text area respectively.

<button> element

It defines a clickable button.

<fieldset> and <legend> elements

The <fieldset> element is used to group the related data in a form whereas the <legend> element defines the caption for the <fieldset> element.

<datalist> element

This element specifies the list of pre-defined options for the <input> element. the list attribute of <input> element should refer to the id attribute of <datalist> element as shown below.

Using this <form> elements we can easily create the form of our design. Hope it is helpful for you if u like it please follow the page and stay super excited for the next article where we are building the Facebook form page.

--

--

Naghma Alam
Naghma Alam

Written by Naghma Alam

0 Followers

Coder by profession, traveler by passion and Chef by hobby.