HTML form tag usage
Generally, the tag is used in forms to collect user input information. The input type is determined by type. The most commonly used form tag is the input tag (). Input types are defined by the type attribute (type). Common input types include text fields, radio buttons, check boxes, drop-down menus, etc.
Forms in HTML can be used to collect various types of input information from users. A form is actually an area containing form elements. The input information of various elements in this area will eventually be submitted to the program script through the form. For example, common ones include user login, registration, publishing articles, etc., which are all submitted to dynamic programs for processing through forms. This section mainly talks about forms and form elements. How to submit form information to dynamic programs will be discussed in future programming language lessons.
The area of the form uses the
Text field
The text field can provide users with the function of inputting text. The browser will interpret the text field as a rectangular box. The user moves the cursor to the box and clicks. The cursor can be moved into the frame. Users can type letters, numbers, etc. into the form.
The text field is defined by setting the text value for the type attribute in the tag
##XML/HTML Code Copy content to clipboard
- ##<
form>
Text field 1: - <
input type=”text” name=”firstname” / >
Text field 2: - <
input type=”text” name=”lastname” />
## form> The browser displays as follows:
Radio button
Radio button in most cases Appears in the options for users to enter information when registering. This type of multi-user only allows users to select one result. The radio button is defined by setting the value of the type attribute to radio in the tag.
<form> <input type=”radio” name=”sex” value=”male” /> 男生 <input type=”radio” name=”sex” value=”female” /> 女生 </form>
- The display in the browser is:
Check box
Checkboxes allow users to select one or more options. A common one is to provide users with functions such as remembering their login account when they log in. You can also collect multiple opinions from users on the user survey page. The check box is defined by setting the value of the type attribute to checkbox in the tag
<form> <input type=”checkbox” name=”val1″ /> 前端开拓者不错 <input type=”checkbox” name=”val2″ /> 前端开拓者一般 </form>
- The browser displays as follows:
Drop-down menu
The drop-down menu is similar to the radio selection in information selection, but the drop-down menu can accommodate more information. And the dropdown menu can execute additional scripts after selecting the menu value. The drop-down menu starts with
<form> <select name=”cars”> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”fiat”>Fiat</option> <option value=”audi”>Audi</option> </select> </form>
- The browser displays:
Submit button
The submit button is every A necessary part of the form. After the user has entered the corresponding information, he needs to click the submit button to trigger the action and submit the form values to the next page. When the action attribute in the

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.
