Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
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:

<label for="fname">First name:</label>
<input type="text" id="fname" 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.

Tip: Always add the <label> tag for best accessibility practices!


Browser Support

Attribute
type="text" Yes Yes Yes Yes Yes

Syntax

<input type="text">

❮ HTML <input> type attribute