Home > Web Front-end > Front-end Q&A > What is the usage of size in html5

What is the usage of size in html5

WBOY
Release: 2021-12-31 11:41:25
Original
6159 people have browsed it

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.

What is the usage of size in html5

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">
Copy after login

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>
Copy after login

Output result:

What is the usage of size in html5

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!

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