In HTML5, the size attribute is used to specify the visible width of the input field, that is, the number of visible characters. The syntax is "<input size="number">"; when the input field is of text or password type , this attribute defines the number of visible characters. When the input field is of other types, this attribute defines the pixel character width.
The operating environment of this tutorial: Windows 10 system, HTML5 version, Dell G3 computer.
What is the usage of size in html5
The size attribute specifies the width of the input field.
The size attribute specifies the visible width of the element in characters.
Note: The size attribute applies to the following input types: text, search, tel, url, email and password.
For and , the size attribute defines the number of visible characters. For other types, the size attribute defines the width of the input field in pixels.
The syntax is as follows:
<input size="number">
Specifies the width of the element in characters. The default value is 20.
The example is as follows:
<html> <head> <meta charset="utf-8"> <title>123</title> </head> <body> <form action="demo_form.php"> Email: <input type="text" name="email" size="35"><br> PIN: <input type="text" name="pin" maxlength="4" size="4"><br> <input type="submit" value="提交"> </form> </body> </html>
Output result:
Recommended tutorial: "html video tutorial"
The above is the detailed content of What is the usage of size in html5. For more information, please follow other related articles on the PHP Chinese website!