An HTML page is made up of various elements—one being the <input> element. The HTML input element is primarily to create HTML forms.

In other words, an HTML <input> tag is used to create the data fields on forms that enable users to enter information.

In this article, we will discuss the following topics:

  • What is an HTML <input> tag?
  • HTML input types
  • Input type text and password
  • Input type checkboxes and buttons
  • Input type file
  • Input type color
  • Input type date
  • Input type week
  • Input type email

What Is an HTML <input> Tag?

The HTML <input> tag is used to declare an input element within a form. It is used to create several input fields in the form to collect the data from the user.

The following is an example of simple text input:

input-tag-HTML-input

Get Access to 200+ Hiring Partners in Our Bootcamp

Full Stack Java Developer Career BootcampEXPLORE COURSE
Get Access to 200+ Hiring Partners in Our Bootcamp

HTML Input Types

The “type” attribute of the HTML <input> element specifies the type of input field that will be displayed. There are several types of input fields, and we will cover the vital ones.

Input Type Text and Password

The <input type=”text”> defines the one-line text input field and <input type= “password”> defines the one-line password input field.

text-and-password-html-inputs.

This is what it should look like:

output-text-and-password.

Input Type Checkboxes and Buttons

Type “ “

Description

Checkbox

Checkboxes enable the user to select multiple options

Radio

Radio enables the user to select one option

Submit

Defines a submit button to send the data to the server

/checkbox-and-button

You will then see the following:

output-checkbox

Input Type File

The  <input type= “file”> is used to select one or multiple files from the user storage device.

input-type-file-html-inputs

This will appear next:

output-file

Input Type Color

The <input type=”color”> defines an input field with a specific color.

input-type-color-html-inputs

This is what you’ll see next:

output-color

Free Course: Programming Fundamentals

Learn the Basics of ProgrammingEnroll Now
Free Course: Programming Fundamentals

Input Type Date

The <input type=”date”> is used for an input field that contains the date.

input-type-date-html-inputs

Using this code will produce the following:

ouput-input-type

Input Type Week

The <input type=”week”> code enables the user to select a week and a year.

input-week.

This coding results in the following:

output-week

Input Type Email

The <input type=”email”> is used for an input field that should have an email address.

input-email

This will produce the following result:

output-email.

Get skilled in HTML5 and CSS3 with the Full Stack Java Developer Master's Program. Click to check out the program details! 

Next Steps

This article on HTML input offered a brief input tag introduction, which also included visual guides that illustrated how to create them. Although we discussed several input types that are required to create an HTML form, certification is highly recommended if you are truly looking to take your coding career to the next level. Simplilearn’s Full Stack Java Developer is an all-encompassing program that will teach you essential Java development skills from the ground up, and provide you with hands-on exercises and projects. Students gain a magnitude of skills through this comprehensive program, including how to test and deploy code, store data using MongoDB, and much more.

If you’re an aspiring web and mobile developer, HTML training will broaden your skills and career opportunities. 

Do you have any questions for us? Please mention leave them in the comments section, and we'll have our experts answer them for you as soon as possible.

About the Author

Aryan GuptaAryan Gupta

Aryan is a tech enthusiast who likes to stay updated about trending technologies of today. He is passionate about all things technology, a keen researcher, and writes to inspire. Aside from technology, he is an active football player and a keen enthusiast of the game.

View More
  • Disclaimer
  • PMP, PMI, PMBOK, CAPM, PgMP, PfMP, ACP, PBA, RMP, SP, and OPM3 are registered marks of the Project Management Institute, Inc.