Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> type="text"

The <input> tag with a type="text" attribute creates a text field.

Text fields accept a single line of text and are among the most frequently used input controls.

Example

#

Four <input> elements of type text which creates single-line textboxes.

Contact information







<form action="/tutorial/action.html">
  <fieldset>
    <legend>Contact information</legend>

    <input type="text" name="firstname" placeholder="First name"><br /><br />
    <input type="text" name="lastname" placeholder="Last name"><br /><br />
    <input type="text" name="email" placeholder="Email"><br /><br />
    <input type="text" name="phone" placeholder="Phone number"><br /><br />

    <input type="submit" value="Submit">
  </fieldset>
</form>

Using input type="text"

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

The default width of text input is 20 characters.

The text input accepts alphanumeric characters for fields like, name, address, city, postal code, etc.


Syntax

<input type="text">

Browser support

Here is when type="text" support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <input>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides