Posts in current category
May 03, 2021 13:05 HTML5
HTML5's and the labels add several new properties.
height and width
min and max
The autocomplete property states that the form or input domain should have autocomplete.
When the user starts typing in the auto-completion domain, the browser should display the options to fill in in that domain.
Tip: The autocomplete property may be turned on in the form element and off in the input element.
Note: autocomplete applies to the labels, as well as the following types of labels: text, search, url, telephone, email, password, datepickers, range, and color.
Turn autocomplete on in HTML form (an input field turns autocomplete off):
Tip: In some browsers, you may need to enable auto-completion for the property to take effect.
A boolean property of the novalidate property.
The novalidate property states that the form or input fields should not be validated when submitting a form.
There is no need to validate the submitted form data
The autofocus property is a boolean property.
The autofocus property specifies that the domain automatically gets focus when the page is loaded.
Let the "First name" input field focus automatically when the page is loaded:
The form property specifies one or more forms to which the input field belongs.
Tip: To refer to more than one form, use a space-separated list.
The input field outside the form refers to HTML form (the input form is still part of the form):
The formaction property is used to describe the URL address submitted by the form.
The formaction property overrides the action property in the element.
Note: The formaction property is used for type-"submit" and type-"image".
The following HTMLform form contains submit buttons for two different addresses:
The formenctype property describes the data encoding that the form is submitted to the server (only for the form in the form of the method"post" form)
The formenctype property overrides the enctype property of the form element.
Note: This property is used in conjunction with type"submit" and type=image.
The first submission button has sent form data by default, and the second submit button sends form data in the "multipart/form-data" encoding format:
The formmethod property defines how forms are submitted.
The formmethod property overrides the method property of the element.
Note: This property can be used with type-"submit" and type-"image".
Redefining instances of how forms are submitted:
The novalidate property is a boolean property.
The novalidate property describes that the element does not need to be validated when the form is submitted.
The formnovalidate property overrides the novolidate property of the element.
Note: The formnovalidate property is used with the type "submit"
Forms for two submit buttons (use and not apply verification):
The formtarget property specifies a name or a keyword to indicate the presentation after the form submission data is received.
The formtarget property overrides the target property of the element.
Note: The formtarget property is used in conjunction with type "submit" and type "image".
A form of two submit buttons, displayed in a different window:
The height and width properties specify the height and width of the image used for the image type.
Note: The height and width properties apply only to the image type of the label.
Tip: Images typically specify both height and width properties. I f the image sets height and width, the space required by the image is preserved when the page is loaded. W ithout these properties, the browser does not know the size of the image and cannot reserve the appropriate space. The picture changes the layout of the page during loading (although the picture is loaded).
An image submission button is defined, using the height and width properties:
The list property specifies the datalist of the input domain. Datalist is a list of options for the input domain.
Predefined values in slt;datalist>
The min, max, and step properties are used to specify qualifications (constraints) for input types that contain numbers or dates.
Note: The min, max, and step properties apply to the following types of labels: date pickers, numbers, and ranges.
The minimum and maximum value settings for the element:
The multiple property is a boolean property.
The multiple property specifies that multiple values can be selected in the element.
Note: The multiple property applies to the following types of hashtags: email and file. : email, and file.
Upload multiple files:
The pattern property describes a regular expression that validates the value of the element.
Note: Pattern properties apply to the following types of tags: text, search, url, tel, email, and password.
Tip: Is used for the global title property to describe the pattern.
The following example shows a text field that can contain only three letters (without numbers and special characters):
The placeholder property provides a hint that describes the value expected by the input field.
A short prompt appears on the input field before the user enters the value.
Note: Placeholder properties apply to the following types of tags: text, search, url, telephone, email, and password.
Input field prompt text t:
The required property is a boolean property.
The required property states that the input field (cannot be empty) must be filled in before submission.
Note: The required property applies to the following types of tags: text, search, url, telephone, email, password, date pickers, number, checkbox, radio, and file.
Input field that cannot be empty:
The step property specifies a legal numeric interval for the input domain.
If step is "3", the legal number is -3, 0, 3, 6, and so on
Tip: The step property can create a zone value with the max and min properties.
Note: Step properties are used with the following type of type: number, range, date, datetime, datetime-local, month, time, and week.
The input step step is set at 3:
|<input>||定义一个 input 域|
Tip: You can practice how to add HTML forms through the programming practice section of this site!