Home > Web Front-end > Front-end Q&A > What are the tags in html forms

What are the tags in html forms

青灯夜游
Release: 2021-06-08 15:11:56
Original
7354 people have browsed it

htmlForm tags: "

", "", "

What are the tags in html forms

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

HTML forms are used to collect different types of user input. Form elements refer to different types of input elements, check boxes, radio buttons, submit buttons, etc.

HTML form tags:

Tags Description
Define the form for user input
Define the input field
Define the text area (a multi-line input control)
Defined The label of the element, usually the input title
defines a group of related form elements and uses an outer frame to enclose them
Defines the title of the
element
Define the drop-down option list
Define the option group
Define the options in the drop-down list
Define a click button
Specifies a predefined input control option list
Defines the key pair generator field of the form
Define a calculation result

Extended information: element

element is the most important form element.

Elements have many forms, according to different type attributes.

1. Text Fields

The text field is set through the tag. When the user wants to type letters, numbers, etc. in the form , the text field will be used.

<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
Copy after login

The browser displays the following:

What are the tags in html forms

Note: The form itself is not visible. Also, in most browsers, the default width of a text field is 20 characters.

2. Password field

The password field is defined by the tag :

<form>
Password: <input type="password" name="pwd">
</form>
Copy after login

The browser display effect is as follows:

What are the tags in html forms

Note: Password field characters will not be displayed in plain text, but will be replaced by asterisks or dots.

3. Radio Buttons

tag defines the form radio button options

<form>
<input type="radio" name="sex" value="male">Male<br>
<input type="radio" name="sex" value="female">Female
</form>
Copy after login

Browser display effect As follows:

What are the tags in html forms

4. Checkboxes

defines the checkbox. Users need to start from Select one or several options from a number of given choices.

<form>
<input type="checkbox" name="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" value="Car">I have a car
</form>
Copy after login

The browser display effect is as follows:

What are the tags in html forms

5. Submit Button

Defines the submit button.

When the user clicks the confirm button, the content of the form will be 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. :

<form name="input" action="html_form_action.php" method="get">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
Copy after login

The browser display effect is as follows:

What are the tags in html forms

If you type a few letters in the text box above and click the confirm button, then enter the data The page that will be sent to "html_form_action.php". This page will display the entered results.

Recommended tutorial: "html video tutorial"

The above is the detailed content of What are the tags in html forms. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template