Tutorials References Exercises Bootcamp Menu
Sign Up Create Website Get Certified Pro

HTML <input type="text">

❮ HTML <input> type attribute


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

type="text" Yes Yes Yes Yes Yes


<input type="text">

❮ HTML <input> type attribute