Javatpoint Logo
Javatpoint Logo

How to Create Text Box in Html

If we want to create the text box in Html document for inserting the characters by the user on the web page then we have to follow the steps which are given below. Using these steps, any user can easily create a text box.

Step 1: Firstly, we have to type the Html code in any text editor or open the existing Html file in the text editor in which we want to create the text box.

Step 2: For creating the text box, firstly we have to define the <form> tag, if not defined in the code. Now, we have to place the cursor at that point in the <form> tag where we want to create the text box. And, then we have to type the <input> tag at that point.

Step 3: After writing the <input> tag, we have to use its attribute whose name is type. This attribute specifies what type of data is to be entered. So, to create the text box we have to give the value "text" in the type attribute.

Step 4: If we want to define the width of the text box, then we can define it with the help of the size attribute.

Step 5: And, at last, we have to save the Html file and then run the file in the browser.

Test it Now

The output of above Html code is shown in the following screenshot:

How to Create Text Box in Html

Youtube For Videos Join Our Youtube Channel: Join Now


  • Send your Feedback to

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA