HTML Basic Tutorial
HTML Media
HTML Advanced Tutorial
HTML input elements support a wide range of attributes that allow developers to customize the behavior, appearance, and functionality of form fields. Here’s a comprehensive list of commonly used input attributes and their purposes:
Type:
type: Specifies the type of input (e.g., text, password, email, etc.).
Try it yourself
Name:
name: Defines the name of the input, which is used to reference the data on form submission.
Try it yourself
Value:
value: Specifies the default value of the input field.
Try it yourself
Placeholder:
placeholder: Displays a short hint that describes the expected value of the input.
Try it yourself
Required:
required: Ensures that the input must be filled before submitting the form.
Try it yourself
Disabled:
disabled: Disables the input field, preventing user interaction.
Try it yourself
Readonly:
readonly: Makes the input field read-only, so users cannot change its value.
Try it yourself
Maxlength:
maxlength: Limits the maximum number of characters allowed in the input.
Try it yourself
Min and Max:
min and max: Defines the minimum and maximum values for inputs of types like number, range, date, etc.
Try it yourself
Step:
step: Specifies the increment for numerical inputs.
Try it yourself
Autocomplete:
autocomplete: Controls whether the browser should auto-fill the input based on previous entries (on or off).
Try it yourself
Autofocus:
autofocus: Automatically focuses the input when the page loads.
Try it yourself
Pattern:
pattern: Defines a regular expression pattern that the input's value must match for validation.
Try it yourself
Multiple:
multiple: Allows multiple values for inputs of types like email or file.
Try it yourself
Size:
size: Specifies the visible width (in characters) of the input.
Try it yourself
Minlength:
minlength: Specifies the minimum number of characters required for input.
Try it yourself
List:
list: Connects the input to a <datalist> element to provide predefined options.
Try it yourself
Accept:
accept: Specifies the file types allowed when using input type="file".
Try it yourself
Height and Width:
height and width: Specifies the size of an input type="image".
Try it yourself
Novalidate:
novalidate: When added to a form, disables HTML5 form validation.
Try it yourself