HTML Basics

HTML Introduction HTML Basic HTML Comments HTML Tags/Elements HTML Attributes HTML Formatting HTML Block and Inline HTML Charsets HTML Classes HTML Colors HTML Div HTML Headings HTML Id HTML Iframes HTML Images HTML File Paths HTML Tables HTML Layout HTML Lists HTML Links <a> HTML Paragraphs HTML Quotations HTML JavaScript HTML Emojis HTML URL Encode HTML Entities HTML Computercode HTML Symbols HTML Styles

HTML Forms

HTML Forms HTML Form Elements HTML Form Attributes HTML Input Attributes HTML Input Regex HTML Input Form Attributes HTML Input Types

HTML SEO

HTML Head HTML Page Title HTML Responsive HTML Semantics HTML Favicon

HTML Graphics

HTML Canvas HTML SVG

HTML Media

HTML Media HTML Audio HTML Video

HTML Reference

a abbr acronym address applet area article aside audio b base basefont bdi bdo big blockquote body br button canvas caption center cite code col colgroup data datalist dd del details dfn dialog dir div dl DOCTYPE dt em embed fieldset figcaption figure font footer form frame frameset h1_-_h6 head header hgroup hr html i iframe img input ins kbd label legend li link main map mark menu meta meter nav noframes noscript object ol optgroup option output p param picture pre progress q rp rt ruby s samp script search section select small source span strike strong style sub summary sup svg table tbody td template textarea tfoot th thead time title tr track tt u ul var video wbr

HTML Input Types Tutorial

An HTML form is used to collect user input. HTML provides different input types to handle different types of data. In this tutorial, we will learn how HTML input types work with fictional examples.

Text Input

The <input type="text"> is used when you want the user to enter a single line of text.


<input type="text" name="username">

Password Input

The <input type="password"> is used when you want the user to enter a password. The text entered in a password input is masked for security reasons.


<input type="password" name="password">

Email Input

The <input type="email"> is used when you want the user to enter an email address. The input must be in the form of an email address.


<input type="email" name="email">

Checkbox Input

The <input type="checkbox"> is used when you want the user to select one or more options from a list.


<input type="checkbox" name="option1" value="Option 1"> Option 1
<input type="checkbox" name="option2" value="Option 2"> Option 2

Radio Input

The <input type="radio"> is used when you want the user to select only one option from a list.


<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female

Submit Button

The <input type="submit"> is used to submit the form data to the server.


<input type="submit" value="Submit">

Number Input

The <input type="number"> is used when you want the user to enter a numerical value.


<input type="number" name="quantity" min="1" max="100">

File Input

The <input type="file"> is used when you want the user to upload a file.


<input type="file" name="file">

Color Input

The <input type="color"> is used when you want the user to select a color.


<input type="color" name="color">

Range Input

The <input type="range"> is used when you want the user to select a value from a range.


<input type="range" name="range" min="0" max="100">