input size Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

The size attribute specifies the visible width, in characters, of an <input> element.

The size attribute works with the following input types: text, search, tel, url, email, and password.

Attribute Values

Value Description
number Specifies the width of an <input> element, in characters. Default value is 20

An HTML form with two input fields with a width of 35 and 4 characters:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="/action_page.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="Submit">
</form><!--from   ww  w.j  a  v  a  2  s  . c o m-->

</body>
</html>

Related Tutorials