Text Input Width for HTML
The text input is an integral part of HTML forms that allow website owners to interact with their visitors. It serves a function similar to the blank line on traditional forms. Site owners can customize its appearance and width.
-
Function
-
The text field is a common field in HTML forms. This is a one-line space into which users can type information such as their name, email address, an anti-spam security phrase or any other information that the site owner may request.
Identification
-
The website owner or developer can extend or minimize the width from the default size of 20 characters by adding a size attribute in the HTML code.
<input type="text" size="50">
The example will produce a text field 2.5 times the length of the default text field.
-
Benefits
-
The size attribute gives site owners control over the appearance of the text input. Text inputs are best used for short phrase entries such as names or email addresses. However, the form may require an entry such as an email address that is longer than the default size. If the input is default width, the text will appear to visitors to cut off. The developer can also shorten or lengthen the text field to match other elements of the website.
Considerations
-
While a website owner or webmaster can alter the length of the text field, it is best suited for shorter phrases, not blocks of text. The website developer should consider the "textarea," a rectangular field, for extended text content.
-
References
- Photo Credit business form image by Matteo Gamba from Fotolia.com