HTML Tutorial

INTRODUCTION

Edit Template
  • Home
  • /
  • HTML Input Types

HTML Tutorial

INTRODUCTION

Edit Template
  • Home
  • /
  • HTML Input Types

HTML Input Types

HTML inputs types are used to collect different kinds of user data in forms. Each type servers a specific role- from typing text to uploading files or selecting dates.

Text Input

Used for single-line text field like names or usernames.

				
					<input type="text" name="username" placeholder="Enter your username">

				
			
  • type=”text” create a standard text box.
  • placeholder gives a hint inside the box.

Password Input

Used to securely entire passwords. The input characters are hidden.

				
					<input type="password" name="password" placeholder="Enter your password">

				
			

Radio Buttons

Allow the user to choose only one option from a group.

				
					<input type="radio" id="male" name="gender" value="male">
<label for="male">Male</label>

<input type="radio" id="female" name="gender" value="female">
<label for="female">Female</label>

				
			
  • All radio buttons with the same name are grouped together.
  • Only one can be selected at a time.

Checkbox

Allows the user to select multiple options.

				
					<input type="checkbox" id="subscribe" name="subscribe" value="yes">
<label for="subscribe">Subscribe to newsletter</label>

				
			

Other Common Input Types

Here’s quick overview of additional inputs type you may encounter:

Input TypePurpose
submitButton to submit the form
resetResets all form inputs to default values
buttonA general button (requires JavaScript)
emailValidates email address input
fileUploads one or more files
hiddenSends invisible data to the server
dateSelects a date
timeSelects time only
datetime-localSelects both date and time
colorOpens a color picker
urlAccepts a website URL
numberInput limited to numbers
rangeSlider for numeric range
telAccepts a telephone number
searchSearch field with a clear (X) icon
monthSelects month and year
weekSelects a specific week
imageSubmits form using an image as a button

Conclusion

Understanding input types helps you create smart and user-friendly forms. Each type is built to collect a specific kind of data, improving user experience and form reliability.

Scroll to Top