THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <input type="text">

❮ HTML <input> type attribute

Example

Define a single-line text field that a user can enter text into:

First name: <input type="text" name="fname">
Try it Yourself »

Definition and Usage

The <input type="text"> defines a single-line text field.

The default width of the text field is 20 characters.


Browser Support

Attribute
type="text" Yes Yes Yes Yes Yes

Syntax

<input type="text">

❮ HTML <input> type attribute