HTML Input Types

Date: 12-1-24, and 12-8-24.

This chapter describes the different types for the HTML <input> element.

HTML Input Types

Here are the different input types you can use in HTML:

Tip: The default value of the type attribute is "text.

Input Type Text

<input type="text"> defines a single-line text input field:

Text field






Note that the form itself is not visible.

Also note that the default width of a text field is 20 characters.

This is how the HTML code above will be displayed in a browser:






Input Type Password

<input type="password"> defines a password field:

Password field

The input type="password" defines a password field:






The characters in a password field are masked (shown as asterisks or circles).

This is how the HTML code above will be displayed in a browser:






Input Type Submit

<input type="submit"> defines a button for submitting form data to a form-handler. The form-handler is typically a server page with a script for processing input data. The form-handler is specified in the form's action attribute:

Submit Button

The input type="submit" defines a button for submitting form data to a form-handler: