Home  >  Article  >  Web Front-end  >  A detailed introduction to HTML forms and input

A detailed introduction to HTML forms and input

高洛峰
高洛峰Original
2017-03-21 17:40:561283browse

HTML Form

A form is an area containing form elements.

Form elements allow users to enter content in the form, such as text areas, drop-down lists, radio-buttons, checkboxes, etc.

Forms are set up using the form tag

:


.
input elements
.


HTML Form - Input Element

The most commonly used form tag is the input tag ().

Input types are defined by the type attribute (type). The most frequently used input types are as follows:


Text Fields

The text field is set through the tag. When the user types letters, numbers, etc. in the form, the text field is used.


First name:

Last name:


Password field

The password field is defined with the tag :


Password:


Radio Buttons(Radio Buttons)

tag defines the form radio button options


Male

Female

The browser display effect is as follows:


Checkboxes

defines a checkbox. The user needs to select one or several options from a number of given choices.


I have a bike

I have a car

The browser display effect is as follows:


Submit Button

defines the submit button.

When the user clicks the confirm button, the form's contents are transferred to another file. The form's action attribute defines the file name of the destination file. The file defined by the action attribute usually performs related processing on the input data received. :

action="html.php" method="get">
Username:



HTML form tag

New : HTML5New tag

Label describe
Define a form for user input
Define input fields