HTML CSS examples for HTML Tag:input
The type attribute specifies the type of <input> element to display.
The default type is text.
HTML5 has the following new input types: color, date, datetime-local, month, week, time, email, number, range, search, tel, and url.
Value | Description |
---|---|
button | clickable button |
checkbox | a checkbox |
color | a color picker |
date | a date control (year, month and day (no time)) |
datetime-local | a date and time control (year, month, day, hour, minute, second, and fraction of a second (no time zone) |
a field for an e-mail address | |
file | a file-select field and a "Browse..." button (for file uploads) |
hidden | a hidden input field |
image | an image as the submit button |
month | a month and year control (no time zone) |
number | a field for entering a number |
password | a password field (characters are masked) |
radio | a radio button |
range | a control for entering a number whose exact value is not important. Default range is from 0 to 100 |
reset | a reset button (resets all form values to default values) |
search | a text field for entering a search string |
submit | a submit button |
tel | a field for entering a telephone number |
text | Default. Defines a single-line text field (default width is 20 characters) |
time | a control for entering a time (no time zone) |
url | a field for entering a URL |
week | a week and year control (no time zone) |
An HTML form with two different input types; text and submit:
<!DOCTYPE html> <html> <body> <form action="/action_page.php"> Username: <input type="text" name="usrname"><br> <input type="submit" value="Submit"> </form><!--from w ww .j a v a 2 s . c o m--> </body> </html>