HTML <input type=”text”>

The HTML <input type=”text”> element creates a text input field, allowing users to enter single-line text. It is commonly used for various purposes such as entering names, email addresses, or messages in forms. The text input element is versatile and widely used in web forms for collecting textual data.

Syntax

<input type="text">

Example: This example demonstrates the use of HTML <input type=”text”> element.

html
<!DOCTYPE html>
<html>

<head>
    <title>HTML Input Type Text</title>
</head>

<body style="text-align:center;">
    <h2>HTML &lt;input type="text"&gt;</h2>

    <form action="#">
        <label for="fname">First Name</label>
        <input type="text" id="fname">
        <br><br>

        <label for="lname">Last Name</label>
        <input type="text" id="lname">
    </form>
</body>

</html>

Output

Supported Browsers

The browsers supported by <input type=”text”> are listed below:

  • Google Chrome 1
  • Edge 12
  • Firefox 1
  • Opera 15
  • Safari 1

Contact Us