input type Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:input

Description

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.

Attribute Values

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)
email 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
tela 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)
urla 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:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials